From 3e67a52561ff5da6e2be7dabaa2f5bc3309e173f Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 29 Oct 2020 02:26:47 +0000 Subject: [PATCH] Generated from 18068a88771f5df534aacf246416dcab4e1ff3d0 --- sdk/sql/mgmt-v2018_06_01_preview/pom.xml | 6 +- .../CatalogCollationType.java | 41 + .../CompleteDatabaseRestoreDefinition.java | 44 + .../CurrentSensitivityLabels.java | 65 + .../DatabaseSecurityAlertPolicies.java | 42 + .../DatabaseSecurityAlertPolicy.java | 287 ++ .../v2018_06_01_preview/DatabaseState.java | 44 + .../sql/v2018_06_01_preview/Databases.java | 28 + .../sql/v2018_06_01_preview/ElasticPools.java | 28 + .../sql/v2018_06_01_preview/IdentityType.java | 38 + .../sql/v2018_06_01_preview/InstancePool.java | 148 + .../InstancePoolLicenseType.java | 41 + .../InstancePoolUpdate.java | 44 + .../v2018_06_01_preview/InstancePools.java | 25 + ...ngTermRetentionManagedInstanceBackups.java | 133 + .../v2018_06_01_preview/ManagedDatabase.java | 451 +++ .../ManagedDatabaseCreateMode.java | 50 + .../ManagedDatabaseRestoreDetails.java | 30 + .../ManagedDatabaseRestoreDetailsResult.java | 89 + .../ManagedDatabaseSensitivityLabels.java | 106 + .../ManagedDatabaseStatus.java | 56 + .../ManagedDatabaseUpdate.java | 403 +++ .../v2018_06_01_preview/ManagedDatabases.java | 70 + .../v2018_06_01_preview/ManagedInstance.java | 702 ++++ .../ManagedInstanceLicenseType.java | 41 + ...anagedInstanceLongTermRetentionBackup.java | 68 + ...agedInstanceLongTermRetentionPolicies.java | 42 + ...anagedInstanceLongTermRetentionPolicy.java | 205 ++ .../ManagedInstanceOperation.java | 113 + ...anagedInstanceOperationParametersPair.java | 47 + .../ManagedInstanceOperationSteps.java | 63 + .../ManagedInstanceOperations.java | 39 + .../ManagedInstanceProxyOverride.java | 44 + .../ManagedInstanceUpdate.java | 602 ++++ ...anagedInstanceVulnerabilityAssessment.java | 4 +- .../v2018_06_01_preview/ManagedInstances.java | 68 + .../ManagedServerCreateMode.java | 41 + .../ManagementOperationState.java | 53 + .../sql/v2018_06_01_preview/Name.java | 69 + .../PrivateEndpointConnection.java | 151 + .../PrivateEndpointConnections.java | 53 + .../PrivateEndpointProperty.java | 43 + ...ateLinkServiceConnectionStateProperty.java | 84 + .../RecommendedSensitivityLabels.java | 65 + .../sql/v2018_06_01_preview/ReplicaType.java | 41 + .../v2018_06_01_preview/ResourceIdentity.java | 76 + .../SecurityAlertPolicyState.java | 56 + .../SensitivityLabelRank.java | 62 + .../SensitivityLabelSource.java | 53 + .../SensitivityLabels.java | 242 ++ .../ServerAzureADAdministrator.java | 169 + .../ServerAzureADAdministrators.java | 56 + .../ServerVulnerabilityAssessment.java | 4 +- .../sql/v2018_06_01_preview/Sku.java | 148 + ...psertManagedServerOperationParameters.java | 121 + .../UpsertManagedServerOperationStep.java | 96 + .../sql/v2018_06_01_preview/Usage.java | 55 + .../sql/v2018_06_01_preview/Usages.java | 29 + .../CurrentSensitivityLabelsImpl.java | 76 + .../DatabaseSecurityAlertPoliciesImpl.java | 78 + .../DatabaseSecurityAlertPoliciesInner.java | 520 +++ .../DatabaseSecurityAlertPolicyImpl.java | 180 + .../DatabaseSecurityAlertPolicyInner.java | 227 ++ .../implementation/DatabasesImpl.java | 34 + .../implementation/DatabasesInner.java | 402 +++ .../implementation/ElasticPoolsImpl.java | 34 + .../implementation/ElasticPoolsInner.java | 232 ++ .../implementation/InstancePoolImpl.java | 92 + .../implementation/InstancePoolInner.java | 128 + .../implementation/InstancePoolsImpl.java | 138 + .../implementation/InstancePoolsInner.java | 1297 ++++++++ ...rmRetentionManagedInstanceBackupsImpl.java | 184 ++ ...mRetentionManagedInstanceBackupsInner.java | 2941 +++++++++++++++++ .../implementation/ManagedDatabaseImpl.java | 322 ++ .../implementation/ManagedDatabaseInner.java | 380 +++ .../ManagedDatabaseRestoreDetailsImpl.java | 50 + .../ManagedDatabaseRestoreDetailsInner.java | 154 + ...nagedDatabaseRestoreDetailsResultImpl.java | 110 + ...agedDatabaseRestoreDetailsResultInner.java | 172 + .../ManagedDatabaseSensitivityLabelsImpl.java | 137 + ...ManagedDatabaseSensitivityLabelsInner.java | 1447 ++++++++ .../implementation/ManagedDatabasesImpl.java | 99 + .../implementation/ManagedDatabasesInner.java | 1169 +++++++ .../implementation/ManagedInstanceImpl.java | 442 +++ .../implementation/ManagedInstanceInner.java | 608 ++++ ...edInstanceLongTermRetentionBackupImpl.java | 91 + ...dInstanceLongTermRetentionBackupInner.java | 111 + ...InstanceLongTermRetentionPoliciesImpl.java | 78 + ...nstanceLongTermRetentionPoliciesInner.java | 609 ++++ ...edInstanceLongTermRetentionPolicyImpl.java | 139 + ...dInstanceLongTermRetentionPolicyInner.java | 124 + .../ManagedInstanceOperationImpl.java | 137 + .../ManagedInstanceOperationInner.java | 250 ++ .../ManagedInstanceOperationsImpl.java | 77 + .../ManagedInstanceOperationsInner.java | 402 +++ ...dInstanceVulnerabilityAssessmentInner.java | 8 +- ...dInstanceVulnerabilityAssessmentsImpl.java | 10 +- .../implementation/ManagedInstancesImpl.java | 117 + .../implementation/ManagedInstancesInner.java | 1387 ++++++++ .../PrivateEndpointConnectionImpl.java | 123 + .../PrivateEndpointConnectionInner.java | 89 + .../PrivateEndpointConnectionsImpl.java | 85 + .../PrivateEndpointConnectionsInner.java | 776 +++++ .../RecommendedSensitivityLabelsImpl.java | 76 + .../implementation/SensitivityLabelInner.java | 168 + .../implementation/SensitivityLabelsImpl.java | 165 + .../ServerAzureADAdministratorImpl.java | 137 + .../ServerAzureADAdministratorInner.java | 134 + .../ServerAzureADAdministratorsImpl.java | 92 + .../ServerAzureADAdministratorsInner.java | 748 +++++ .../ServerVulnerabilityAssessmentInner.java | 8 +- .../ServerVulnerabilityAssessmentsImpl.java | 10 +- .../SqlManagementClientImpl.java | 196 ++ .../implementation/SqlManager.java | 168 + .../implementation/UsageImpl.java | 66 + .../implementation/UsageInner.java | 123 + .../implementation/UsagesImpl.java | 53 + .../implementation/UsagesInner.java | 425 +++ 118 files changed, 24889 insertions(+), 20 deletions(-) create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CatalogCollationType.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CompleteDatabaseRestoreDefinition.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CurrentSensitivityLabels.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicies.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicy.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseState.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Databases.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ElasticPools.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/IdentityType.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/LongTermRetentionManagedInstanceBackups.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabase.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseCreateMode.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetails.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetailsResult.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseSensitivityLabels.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseStatus.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseUpdate.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabases.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstance.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLicenseType.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionBackup.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicies.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicy.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperation.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationParametersPair.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationSteps.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperations.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceProxyOverride.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceUpdate.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstances.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedServerCreateMode.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagementOperationState.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnection.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnections.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointProperty.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/RecommendedSensitivityLabels.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ReplicaType.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ResourceIdentity.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SecurityAlertPolicyState.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelRank.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelSource.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabels.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrator.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrators.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationParameters.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationStep.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/CurrentSensitivityLabelsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/RecommendedSensitivityLabelsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java create mode 100644 sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java diff --git a/sdk/sql/mgmt-v2018_06_01_preview/pom.xml b/sdk/sql/mgmt-v2018_06_01_preview/pom.xml index e80ed8c520c34..74af17cb02605 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/pom.xml +++ b/sdk/sql/mgmt-v2018_06_01_preview/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.2.0 - ../../parents/azure-arm-parent + 1.1.0 + ../../../pom.management.xml azure-mgmt-sql 1.0.0-beta @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CatalogCollationType.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CatalogCollationType.java new file mode 100644 index 0000000000000..085313fa204b0 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CatalogCollationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CatalogCollationType. + */ +public final class CatalogCollationType extends ExpandableStringEnum { + /** Static value DATABASE_DEFAULT for CatalogCollationType. */ + public static final CatalogCollationType DATABASE_DEFAULT = fromString("DATABASE_DEFAULT"); + + /** Static value SQL_Latin1_General_CP1_CI_AS for CatalogCollationType. */ + public static final CatalogCollationType SQL_LATIN1_GENERAL_CP1_CI_AS = fromString("SQL_Latin1_General_CP1_CI_AS"); + + /** + * Creates or finds a CatalogCollationType from its string representation. + * @param name a name to look for + * @return the corresponding CatalogCollationType + */ + @JsonCreator + public static CatalogCollationType fromString(String name) { + return fromString(name, CatalogCollationType.class); + } + + /** + * @return known CatalogCollationType values + */ + public static Collection values() { + return values(CatalogCollationType.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CompleteDatabaseRestoreDefinition.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 0000000000000..6e842f0ec27ac --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CompleteDatabaseRestoreDefinition.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a complete database restore + * operation. + */ +public class CompleteDatabaseRestoreDefinition { + /** + * The last backup name to apply. + */ + @JsonProperty(value = "lastBackupName", required = true) + private String lastBackupName; + + /** + * Get the last backup name to apply. + * + * @return the lastBackupName value + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the last backup name to apply. + * + * @param lastBackupName the lastBackupName value to set + * @return the CompleteDatabaseRestoreDefinition object itself. + */ + public CompleteDatabaseRestoreDefinition withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CurrentSensitivityLabels.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CurrentSensitivityLabels.java new file mode 100644 index 0000000000000..824a83a9221b6 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/CurrentSensitivityLabels.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing CurrentSensitivityLabels. + */ +public interface CurrentSensitivityLabels extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rank value. + */ + SensitivityLabelRank rank(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicies.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..2a9d172227456 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicies.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.DatabaseSecurityAlertPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseSecurityAlertPolicies. + */ +public interface DatabaseSecurityAlertPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicy.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..a9b72df9026ea --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.DatabaseSecurityAlertPolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseSecurityAlertPolicy. + */ +public interface DatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseSecurityAlertPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param serverName The name of the server + * @param databaseName The name of the database for which the security alert policy is defined + * @return the next definition stage + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next definition stage + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next definition stage + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next definition stage + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next definition stage + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDisabledAlerts, DefinitionStages.WithEmailAccountAdmins, DefinitionStages.WithEmailAddresses, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a DatabaseSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next update stage + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next update stage + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next update stage + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next update stage + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next update stage + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next update stage + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseState.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseState.java new file mode 100644 index 0000000000000..eccf918464264 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/DatabaseState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseState. + */ +public final class DatabaseState extends ExpandableStringEnum { + /** Static value All for DatabaseState. */ + public static final DatabaseState ALL = fromString("All"); + + /** Static value Live for DatabaseState. */ + public static final DatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for DatabaseState. */ + public static final DatabaseState DELETED = fromString("Deleted"); + + /** + * 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); + } + + /** + * @return known DatabaseState values + */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Databases.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Databases.java new file mode 100644 index 0000000000000..87bb5cd32216b --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Databases.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Completable; + +/** + * Type representing Databases. + */ +public interface Databases { + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ElasticPools.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ElasticPools.java new file mode 100644 index 0000000000000..8558918dba84e --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ElasticPools.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Completable; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools { + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/IdentityType.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/IdentityType.java new file mode 100644 index 0000000000000..3f3e8108ef518 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/IdentityType.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IdentityType. + */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a IdentityType from its string representation. + * @param name a name to look for + * @return the corresponding IdentityType + */ + @JsonCreator + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * @return known IdentityType values + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java new file mode 100644 index 0000000000000..745b2bb78cd65 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.InstancePoolInner; + +/** + * Type representing InstancePool. + */ +public interface InstancePool extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the licenseType value. + */ + InstancePoolLicenseType licenseType(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the vCores value. + */ + int vCores(); + + /** + * The entirety of the InstancePool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithLicenseType, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores, DefinitionStages.WithCreate { + } + + /** + * Grouping of InstancePool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InstancePool definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the InstancePool definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the instancepool definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + * @param licenseType The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice' + * @return the next definition stage +*/ + WithSubnetId withLicenseType(InstancePoolLicenseType licenseType); + } + + /** + * The stage of the instancepool definition allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + * @param subnetId Resource ID of the subnet to place this instance pool in + * @return the next definition stage +*/ + WithVCores withSubnetId(String subnetId); + } + + /** + * The stage of the instancepool definition allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + * @param vCores Count of vCores belonging to this instance pool + * @return the next definition stage +*/ + WithCreate withVCores(int vCores); + } + + /** + * The stage of the instancepool definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The name and tier of the SKU + * @return the next definition stage + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithSku { + } + } + /** + * The template for a InstancePool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku { + } + + /** + * Grouping of InstancePool update stages. + */ + interface UpdateStages { + /** + * The stage of the instancepool update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The name and tier of the SKU + * @return the next update stage + */ + Update withSku(Sku sku); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java new file mode 100644 index 0000000000000..e60936bc2c522 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstancePoolLicenseType. + */ +public final class InstancePoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a InstancePoolLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding InstancePoolLicenseType + */ + @JsonCreator + public static InstancePoolLicenseType fromString(String name) { + return fromString(name, InstancePoolLicenseType.class); + } + + /** + * @return known InstancePoolLicenseType values + */ + public static Collection values() { + return values(InstancePoolLicenseType.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java new file mode 100644 index 0000000000000..6b5ca0c0f12d2 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update to an Instance pool. + */ +public class InstancePoolUpdate { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the InstancePoolUpdate object itself. + */ + public InstancePoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java new file mode 100644 index 0000000000000..1b5d82f79ac12 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.InstancePoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InstancePools. + */ +public interface InstancePools extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/LongTermRetentionManagedInstanceBackups.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/LongTermRetentionManagedInstanceBackups.java new file mode 100644 index 0000000000000..172788f225d29 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/LongTermRetentionManagedInstanceBackups.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.LongTermRetentionManagedInstanceBackupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LongTermRetentionManagedInstanceBackups. + */ +public interface LongTermRetentionManagedInstanceBackups extends HasInner { + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstanceAsync(final String locationName, final String managedInstanceName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String locationName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabase.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabase.java new file mode 100644 index 0000000000000..218580c4679fe --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabase.java @@ -0,0 +1,451 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedDatabaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing ManagedDatabase. + */ +public interface ManagedDatabase extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the createMode value. + */ + ManagedDatabaseCreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestorePoint value. + */ + DateTime earliestRestorePoint(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + ManagedDatabaseStatus status(); + + /** + * @return the storageContainerSasToken value. + */ + String storageContainerSasToken(); + + /** + * @return the storageContainerUri value. + */ + String storageContainerUri(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedDatabase definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedDatabase definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedDatabase definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the manageddatabase definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param managedInstanceName The name of the managed instance + * @return the next definition stage + */ + WithLocation withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the manageddatabase definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the manageddatabase definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + * @param catalogCollation Collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @return the next definition stage + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + * @param collation Collation of the managed database + * @return the next definition stage + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the manageddatabase definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup' + * @return the next definition stage + */ + WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase definition allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + * @param longTermRetentionBackupResourceId The name of the Long Term Retention backup to be used for restore of this managed database + * @return the next definition stage + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the manageddatabase definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create operation of this database + * @return the next definition stage + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating this database + * @return the next definition stage + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database + * @return the next definition stage + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + * @param sourceDatabaseId The resource identifier of the source database associated with create operation of this database + * @return the next definition stage + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + * @param storageContainerSasToken Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token + * @return the next definition stage + */ + WithCreate withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + * @param storageContainerUri Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored + * @return the next definition stage + */ + WithCreate withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithStorageContainerSasToken, DefinitionStages.WithStorageContainerUri, DefinitionStages.WithTags { + } + } + /** + * The template for a ManagedDatabase update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSourceDatabaseId, UpdateStages.WithStorageContainerSasToken, UpdateStages.WithStorageContainerUri, UpdateStages.WithTags { + } + + /** + * Grouping of ManagedDatabase update stages. + */ + interface UpdateStages { + /** + * The stage of the manageddatabase update allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + * @param catalogCollation Collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @return the next update stage + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + * @param collation Collation of the managed database + * @return the next update stage + */ + Update withCollation(String collation); + } + + /** + * The stage of the manageddatabase update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup' + * @return the next update stage + */ + Update withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase update allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + * @param longTermRetentionBackupResourceId The name of the Long Term Retention backup to be used for restore of this managed database + * @return the next update stage + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the manageddatabase update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create operation of this database + * @return the next update stage + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating this database + * @return the next update stage + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database + * @return the next update stage + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + * @param sourceDatabaseId The resource identifier of the source database associated with create operation of this database + * @return the next update stage + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + * @param storageContainerSasToken Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token + * @return the next update stage + */ + Update withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + * @param storageContainerUri Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored + * @return the next update stage + */ + Update withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseCreateMode.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseCreateMode.java new file mode 100644 index 0000000000000..0866411a9d619 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseCreateMode.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedDatabaseCreateMode. + */ +public final class ManagedDatabaseCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode DEFAULT = fromString("Default"); + + /** Static value RestoreExternalBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value PointInTimeRestore for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Recovery for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreLongTermRetentionBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a ManagedDatabaseCreateMode from its string representation. + * @param name a name to look for + * @return the corresponding ManagedDatabaseCreateMode + */ + @JsonCreator + public static ManagedDatabaseCreateMode fromString(String name) { + return fromString(name, ManagedDatabaseCreateMode.class); + } + + /** + * @return known ManagedDatabaseCreateMode values + */ + public static Collection values() { + return values(ManagedDatabaseCreateMode.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetails.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetails.java new file mode 100644 index 0000000000000..d5ea5e83dc7c3 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetails.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedDatabaseRestoreDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseRestoreDetails. + */ +public interface ManagedDatabaseRestoreDetails extends HasInner { + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetailsResult.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetailsResult.java new file mode 100644 index 0000000000000..df5785a8e5e76 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseRestoreDetailsResult.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedDatabaseRestoreDetailsResultInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ManagedDatabaseRestoreDetailsResult. + */ +public interface ManagedDatabaseRestoreDetailsResult extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the blockReason value. + */ + String blockReason(); + + /** + * @return the currentRestoringFileName value. + */ + String currentRestoringFileName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastRestoredFileName value. + */ + String lastRestoredFileName(); + + /** + * @return the lastRestoredFileTime value. + */ + DateTime lastRestoredFileTime(); + + /** + * @return the lastUploadedFileName value. + */ + String lastUploadedFileName(); + + /** + * @return the lastUploadedFileTime value. + */ + DateTime lastUploadedFileTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFilesDetected value. + */ + Long numberOfFilesDetected(); + + /** + * @return the percentCompleted value. + */ + Double percentCompleted(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unrestorableFiles value. + */ + List unrestorableFiles(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseSensitivityLabels.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseSensitivityLabels.java new file mode 100644 index 0000000000000..939f23a3d5e92 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseSensitivityLabels.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.CurrentSensitivityLabels; +import com.microsoft.azure.management.sql.v2018_06_01_preview.RecommendedSensitivityLabels; + +/** + * Type representing ManagedDatabaseSensitivityLabels. + */ +public interface ManagedDatabaseSensitivityLabels { + /** + * Begins definition for a new SensitivityLabel resource. + * @param name resource name. + * @return the first stage of the new SensitivityLabel definition. + */ + SensitivityLabels.DefinitionStages.Blank defineSensitivityLabel(String name); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable disableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseStatus.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseStatus.java new file mode 100644 index 0000000000000..deb8a89dd767d --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedDatabaseStatus. + */ +public final class ManagedDatabaseStatus extends ExpandableStringEnum { + /** Static value Online for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus ONLINE = fromString("Online"); + + /** Static value Offline for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Shutdown for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value Creating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value Restoring for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value Updating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a ManagedDatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding ManagedDatabaseStatus + */ + @JsonCreator + public static ManagedDatabaseStatus fromString(String name) { + return fromString(name, ManagedDatabaseStatus.class); + } + + /** + * @return known ManagedDatabaseStatus values + */ + public static Collection values() { + return values(ManagedDatabaseStatus.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseUpdate.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseUpdate.java new file mode 100644 index 0000000000000..1c942c10af6f4 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabaseUpdate.java @@ -0,0 +1,403 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An managed database update. + */ +@JsonFlatten +public class ManagedDatabaseUpdate { + /** + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Status of the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /** + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestorePoint; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Recovery: Creates a database + * by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. Possible + * values include: 'Default', 'RestoreExternalBackup', + * 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /** + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The name of the Long Term Retention backup to be used for restore of + * this managed database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get collation of the managed database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set collation of the managed database. + * + * @param collation the collation value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating'. + * + * @return the status value + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get creation date of the database. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value + */ + public DateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get geo paired region. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @param catalogCollation the catalogCollation value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @return the storageContainerUri value + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @param storageContainerUri the storageContainerUri value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the resource identifier of the source database associated with create operation of this database. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the resource identifier of the source database associated with create operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorable dropped database resource id to restore when creating this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorable dropped database resource id to restore when creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. + * + * @return the storageContainerSasToken value + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. + * + * @param storageContainerSasToken the storageContainerSasToken value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get instance Failover Group resource identifier that this managed database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the resource identifier of the recoverable database associated with create operation of this database. + * + * @return the recoverableDatabaseId value + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the resource identifier of the recoverable database associated with create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the name of the Long Term Retention backup to be used for restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the name of the Long Term Retention backup to be used for restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabases.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabases.java new file mode 100644 index 0000000000000..5633f5645f170 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedDatabases.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabase; +import rx.Completable; + +/** + * Type representing ManagedDatabases. + */ +public interface ManagedDatabases { + /** + * Begins definition for a new Databasis resource. + * @param name resource name. + * @return the first stage of the new Databasis definition. + */ + ManagedDatabase.DefinitionStages.Blank defineDatabasis(String name); + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable completeRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstance.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstance.java new file mode 100644 index 0000000000000..93ff1bddeae11 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstance.java @@ -0,0 +1,702 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstanceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing ManagedInstance. + */ +public interface ManagedInstance extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the dnsZone value. + */ + String dnsZone(); + + /** + * @return the dnsZonePartner value. + */ + String dnsZonePartner(); + + /** + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * @return the instancePoolId value. + */ + String instancePoolId(); + + /** + * @return the licenseType value. + */ + ManagedInstanceLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * @return the managedInstanceCreateMode value. + */ + ManagedServerCreateMode managedInstanceCreateMode(); + + /** + * @return the minimalTlsVersion value. + */ + String minimalTlsVersion(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the proxyOverride value. + */ + ManagedInstanceProxyOverride proxyOverride(); + + /** + * @return the publicDataEndpointEnabled value. + */ + Boolean publicDataEndpointEnabled(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the storageSizeInGB value. + */ + Integer storageSizeInGB(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the timezoneId value. + */ + String timezoneId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vCores value. + */ + Integer vCores(); + + /** + * The entirety of the ManagedInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithInstancePool, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstance definition. + */ + interface Blank extends WithInstancePool { + } + + /** + * The stage of the managedinstance definition allowing to specify InstancePool. + */ + interface WithInstancePool { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @return the next definition stage + */ + WithLocation withExistingInstancePool(String resourceGroupName); + } + + /** + * The stage of the managedinstance definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the managedinstance definition allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + * @param administratorLogin Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation) + * @return the next definition stage + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance definition allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + * @param administratorLoginPassword The administrator login password (required for managed instance creation) + * @return the next definition stage + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + * @param collation Collation of the managed instance + * @return the next definition stage + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the managedinstance definition allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + * @param dnsZonePartner The resource id of another managed instance whose DNS zone this managed instance will share after creation + * @return the next definition stage + */ + WithCreate withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The Azure Active Directory identity of the managed instance + * @return the next definition stage + */ + WithCreate withIdentity(ResourceIdentity identity); + } + + /** + * The stage of the managedinstance definition allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + * @param instancePoolId The Id of the instance pool this managed server belongs to + * @return the next definition stage + */ + WithCreate withInstancePoolId(String instancePoolId); + } + + /** + * The stage of the managedinstance definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' + * @return the next definition stage + */ + WithCreate withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance definition allowing to specify MaintenanceConfigurationId. + */ + interface WithMaintenanceConfigurationId { + /** + * Specifies maintenanceConfigurationId. + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed instance + * @return the next definition stage + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + + /** + * The stage of the managedinstance definition allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + * @param managedInstanceCreateMode Specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore' + * @return the next definition stage + */ + WithCreate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + + /** + * The stage of the managedinstance definition allowing to specify MinimalTlsVersion. + */ + interface WithMinimalTlsVersion { + /** + * Specifies minimalTlsVersion. + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + * @return the next definition stage + */ + WithCreate withMinimalTlsVersion(String minimalTlsVersion); + } + + /** + * The stage of the managedinstance definition allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + * @param proxyOverride Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' + * @return the next definition stage + */ + WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + + /** + * The stage of the managedinstance definition allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled + * @return the next definition stage + */ + WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + + /** + * The stage of the managedinstance definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database + * @return the next definition stage + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the managedinstance definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 + * @return the next definition stage + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the managedinstance definition allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with create operation of this instance + * @return the next definition stage + */ + WithCreate withSourceManagedInstanceId(String sourceManagedInstanceId); + } + + /** + * The stage of the managedinstance definition allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only + * @return the next definition stage + */ + WithCreate withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance definition allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + * @param subnetId Subnet resource ID for the managed instance + * @return the next definition stage + */ + WithCreate withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the managedinstance definition allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time" + * @return the next definition stage + */ + WithCreate withTimezoneId(String timezoneId); + } + + /** + * The stage of the managedinstance definition allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80 + * @return the next definition stage + */ + WithCreate withVCores(Integer vCores); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithInstancePoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithMaintenanceConfigurationId, DefinitionStages.WithManagedInstanceCreateMode, DefinitionStages.WithMinimalTlsVersion, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSku, DefinitionStages.WithSourceManagedInstanceId, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithTags, DefinitionStages.WithTimezoneId, DefinitionStages.WithVCores { + } + } + /** + * The template for a ManagedInstance update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithInstancePoolId, UpdateStages.WithLicenseType, UpdateStages.WithMaintenanceConfigurationId, UpdateStages.WithManagedInstanceCreateMode, UpdateStages.WithMinimalTlsVersion, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithRestorePointInTime, UpdateStages.WithSku, UpdateStages.WithSourceManagedInstanceId, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithTags, UpdateStages.WithTimezoneId, UpdateStages.WithVCores { + } + + /** + * Grouping of ManagedInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstance update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + * @param administratorLogin Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation) + * @return the next update stage + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + * @param administratorLoginPassword The administrator login password (required for managed instance creation) + * @return the next update stage + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + * @param collation Collation of the managed instance + * @return the next update stage + */ + Update withCollation(String collation); + } + + /** + * The stage of the managedinstance update allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + * @param dnsZonePartner The resource id of another managed instance whose DNS zone this managed instance will share after creation + * @return the next update stage + */ + Update withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance update allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + * @param instancePoolId The Id of the instance pool this managed server belongs to + * @return the next update stage + */ + Update withInstancePoolId(String instancePoolId); + } + + /** + * The stage of the managedinstance update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' + * @return the next update stage + */ + Update withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance update allowing to specify MaintenanceConfigurationId. + */ + interface WithMaintenanceConfigurationId { + /** + * Specifies maintenanceConfigurationId. + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed instance + * @return the next update stage + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + + /** + * The stage of the managedinstance update allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + * @param managedInstanceCreateMode Specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore' + * @return the next update stage + */ + Update withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + + /** + * The stage of the managedinstance update allowing to specify MinimalTlsVersion. + */ + interface WithMinimalTlsVersion { + /** + * Specifies minimalTlsVersion. + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + * @return the next update stage + */ + Update withMinimalTlsVersion(String minimalTlsVersion); + } + + /** + * The stage of the managedinstance update allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + * @param proxyOverride Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' + * @return the next update stage + */ + Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + + /** + * The stage of the managedinstance update allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled + * @return the next update stage + */ + Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + + /** + * The stage of the managedinstance update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database + * @return the next update stage + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the managedinstance update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Managed instance sku + * @return the next update stage + */ + Update withSku(Sku sku); + } + + /** + * The stage of the managedinstance update allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with create operation of this instance + * @return the next update stage + */ + Update withSourceManagedInstanceId(String sourceManagedInstanceId); + } + + /** + * The stage of the managedinstance update allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only + * @return the next update stage + */ + Update withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance update allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + * @param subnetId Subnet resource ID for the managed instance + * @return the next update stage + */ + Update withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the managedinstance update allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time" + * @return the next update stage + */ + Update withTimezoneId(String timezoneId); + } + + /** + * The stage of the managedinstance update allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80 + * @return the next update stage + */ + Update withVCores(Integer vCores); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLicenseType.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLicenseType.java new file mode 100644 index 0000000000000..15add2f1065de --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedInstanceLicenseType. + */ +public final class ManagedInstanceLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ManagedInstanceLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ManagedInstanceLicenseType + */ + @JsonCreator + public static ManagedInstanceLicenseType fromString(String name) { + return fromString(name, ManagedInstanceLicenseType.class); + } + + /** + * @return known ManagedInstanceLicenseType values + */ + public static Collection values() { + return values(ManagedInstanceLicenseType.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionBackup.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionBackup.java new file mode 100644 index 0000000000000..c00d5cb9ca368 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionBackup.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstanceLongTermRetentionBackupInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagedInstanceLongTermRetentionBackup. + */ +public interface ManagedInstanceLongTermRetentionBackup extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the backupExpirationTime value. + */ + DateTime backupExpirationTime(); + + /** + * @return the backupTime value. + */ + DateTime backupTime(); + + /** + * @return the databaseDeletionTime value. + */ + DateTime databaseDeletionTime(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the managedInstanceCreateTime value. + */ + DateTime managedInstanceCreateTime(); + + /** + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicies.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..74486d2ced289 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicies.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstanceLongTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceLongTermRetentionPolicies. + */ +public interface ManagedInstanceLongTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicy.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..d787642524891 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceLongTermRetentionPolicy.java @@ -0,0 +1,205 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstanceLongTermRetentionPolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing ManagedInstanceLongTermRetentionPolicy. + */ +public interface ManagedInstanceLongTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the monthlyRetention value. + */ + String monthlyRetention(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the weeklyRetention value. + */ + String weeklyRetention(); + + /** + * @return the weekOfYear value. + */ + Integer weekOfYear(); + + /** + * @return the yearlyRetention value. + */ + String yearlyRetention(); + + /** + * The entirety of the ManagedInstanceLongTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstanceLongTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstanceLongTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the managedinstancelongtermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param managedInstanceName The name of the managed instance + * @param databaseName The name of the database + * @return the next definition stage + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy definition allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format + * @return the next definition stage + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy definition allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format + * @return the next definition stage + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy definition allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format + * @return the next definition stage + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy definition allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format + * @return the next definition stage + */ + WithCreate withYearlyRetention(String yearlyRetention); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithMonthlyRetention, DefinitionStages.WithWeeklyRetention, DefinitionStages.WithWeekOfYear, DefinitionStages.WithYearlyRetention { + } + } + /** + * The template for a ManagedInstanceLongTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithMonthlyRetention, UpdateStages.WithWeeklyRetention, UpdateStages.WithWeekOfYear, UpdateStages.WithYearlyRetention { + } + + /** + * Grouping of ManagedInstanceLongTermRetentionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstancelongtermretentionpolicy update allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format + * @return the next update stage + */ + Update withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy update allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format + * @return the next update stage + */ + Update withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy update allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format + * @return the next update stage + */ + Update withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the managedinstancelongtermretentionpolicy update allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format + * @return the next update stage + */ + Update withYearlyRetention(String yearlyRetention); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperation.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperation.java new file mode 100644 index 0000000000000..4462343266690 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperation.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstanceOperationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagedInstanceOperation. + */ +public interface ManagedInstanceOperation extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the estimatedCompletionTime value. + */ + DateTime estimatedCompletionTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the operationParameters value. + */ + ManagedInstanceOperationParametersPair operationParameters(); + + /** + * @return the operationSteps value. + */ + ManagedInstanceOperationSteps operationSteps(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + ManagementOperationState state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationParametersPair.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationParametersPair.java new file mode 100644 index 0000000000000..09968b76157e9 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationParametersPair.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters of a managed instance operation. + */ +public class ManagedInstanceOperationParametersPair { + /** + * The current parameters. + */ + @JsonProperty(value = "currentParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters currentParameters; + + /** + * The requested parameters. + */ + @JsonProperty(value = "requestedParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters requestedParameters; + + /** + * Get the current parameters. + * + * @return the currentParameters value + */ + public UpsertManagedServerOperationParameters currentParameters() { + return this.currentParameters; + } + + /** + * Get the requested parameters. + * + * @return the requestedParameters value + */ + public UpsertManagedServerOperationParameters requestedParameters() { + return this.requestedParameters; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationSteps.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationSteps.java new file mode 100644 index 0000000000000..2066adaba9e46 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperationSteps.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The steps of a managed instance operation. + */ +public class ManagedInstanceOperationSteps { + /** + * The total number of operation steps. + */ + @JsonProperty(value = "totalSteps", access = JsonProperty.Access.WRITE_ONLY) + private String totalSteps; + + /** + * The number of current operation steps. + */ + @JsonProperty(value = "currentStep", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentStep; + + /** + * The operation steps list. + */ + @JsonProperty(value = "stepsList", access = JsonProperty.Access.WRITE_ONLY) + private List stepsList; + + /** + * Get the total number of operation steps. + * + * @return the totalSteps value + */ + public String totalSteps() { + return this.totalSteps; + } + + /** + * Get the number of current operation steps. + * + * @return the currentStep value + */ + public Integer currentStep() { + return this.currentStep; + } + + /** + * Get the operation steps list. + * + * @return the stepsList value + */ + public List stepsList() { + return this.stepsList; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperations.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperations.java new file mode 100644 index 0000000000000..8d5b9fbb7be77 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceOperations.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperation; + +/** + * Type representing ManagedInstanceOperations. + */ +public interface ManagedInstanceOperations { + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId the UUID value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagedInstanceAsync(final String resourceGroupName, final String managedInstanceName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceProxyOverride.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceProxyOverride.java new file mode 100644 index 0000000000000..58fa06c5df64b --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceProxyOverride.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedInstanceProxyOverride. + */ +public final class ManagedInstanceProxyOverride extends ExpandableStringEnum { + /** Static value Proxy for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride PROXY = fromString("Proxy"); + + /** Static value Redirect for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride REDIRECT = fromString("Redirect"); + + /** Static value Default for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride DEFAULT = fromString("Default"); + + /** + * Creates or finds a ManagedInstanceProxyOverride from its string representation. + * @param name a name to look for + * @return the corresponding ManagedInstanceProxyOverride + */ + @JsonCreator + public static ManagedInstanceProxyOverride fromString(String name) { + return fromString(name, ManagedInstanceProxyOverride.class); + } + + /** + * @return known ManagedInstanceProxyOverride values + */ + public static Collection values() { + return values(ManagedInstanceProxyOverride.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceUpdate.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceUpdate.java new file mode 100644 index 0000000000000..299010982f56c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceUpdate.java @@ -0,0 +1,602 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database managed instance. + */ +@JsonFlatten +public class ManagedInstanceUpdate { + /** + * Managed instance sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /** + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /** + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ManagedInstanceLicenseType licenseType; + + /** + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Collation of the managed instance. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "properties.dnsZone", access = JsonProperty.Access.WRITE_ONLY) + private String dnsZone; + + /** + * The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + */ + @JsonProperty(value = "properties.dnsZonePartner") + private String dnsZonePartner; + + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + + /** + * Specifies maintenance configuration id to apply to this managed + * instance. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get managed instance sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set managed instance sku. + * + * @param sku the sku value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + + /** + * Get the fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for managed instance creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for managed instance creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get subnet resource ID for the managed instance. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state of the managed instance. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ManagedInstanceLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(ManagedInstanceLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get collation of the managed instance. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set collation of the managed instance. + * + * @param collation the collation value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the Dns Zone that the managed instance is in. + * + * @return the dnsZone value + */ + public String dnsZone() { + return this.dnsZone; + } + + /** + * Get the resource id of another managed instance whose DNS zone this managed instance will share after creation. + * + * @return the dnsZonePartner value + */ + public String dnsZonePartner() { + return this.dnsZonePartner; + } + + /** + * Set the resource id of another managed instance whose DNS zone this managed instance will share after creation. + * + * @param dnsZonePartner the dnsZonePartner value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withDnsZonePartner(String dnsZonePartner) { + this.dnsZonePartner = dnsZonePartner; + return this; + } + + /** + * Get whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @return the proxyOverride value + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + + /** + * Get specifies maintenance configuration id to apply to this managed instance. + * + * @return the maintenanceConfigurationId value + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set specifies maintenance configuration id to apply to this managed instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java index ffae1802476df..762197872f648 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java @@ -128,7 +128,7 @@ interface WithStorageAccountAccessKey { interface WithStorageContainerSasKey { /** * Specifies storageContainerSasKey. - * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required * @return the next definition stage */ WithCreate withStorageContainerSasKey(String storageContainerSasKey); @@ -182,7 +182,7 @@ interface WithStorageAccountAccessKey { interface WithStorageContainerSasKey { /** * Specifies storageContainerSasKey. - * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required * @return the next update stage */ Update withStorageContainerSasKey(String storageContainerSasKey); diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstances.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstances.java new file mode 100644 index 0000000000000..13c10cae8766c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstances.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ManagedInstancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstances. + */ +public interface ManagedInstances extends SupportsCreating, HasInner { + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedServerCreateMode.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedServerCreateMode.java new file mode 100644 index 0000000000000..dbf9d80629613 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedServerCreateMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedServerCreateMode. + */ +public final class ManagedServerCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedServerCreateMode from its string representation. + * @param name a name to look for + * @return the corresponding ManagedServerCreateMode + */ + @JsonCreator + public static ManagedServerCreateMode fromString(String name) { + return fromString(name, ManagedServerCreateMode.class); + } + + /** + * @return known ManagedServerCreateMode values + */ + public static Collection values() { + return values(ManagedServerCreateMode.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagementOperationState.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagementOperationState.java new file mode 100644 index 0000000000000..9adf67dd7d599 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagementOperationState.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagementOperationState. + */ +public final class ManagementOperationState extends ExpandableStringEnum { + /** Static value Pending for ManagementOperationState. */ + public static final ManagementOperationState PENDING = fromString("Pending"); + + /** Static value InProgress for ManagementOperationState. */ + public static final ManagementOperationState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ManagementOperationState. */ + public static final ManagementOperationState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagementOperationState. */ + public static final ManagementOperationState FAILED = fromString("Failed"); + + /** Static value CancelInProgress for ManagementOperationState. */ + public static final ManagementOperationState CANCEL_IN_PROGRESS = fromString("CancelInProgress"); + + /** Static value Cancelled for ManagementOperationState. */ + public static final ManagementOperationState CANCELLED = fromString("Cancelled"); + + /** + * Creates or finds a ManagementOperationState from its string representation. + * @param name a name to look for + * @return the corresponding ManagementOperationState + */ + @JsonCreator + public static ManagementOperationState fromString(String name) { + return fromString(name, ManagementOperationState.class); + } + + /** + * @return known ManagementOperationState values + */ + public static Collection values() { + return values(ManagementOperationState.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java new file mode 100644 index 0000000000000..84e216d07f39a --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ARM Usage Name. + */ +public class Name { + /** + * Usage name value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Usage name localized value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get usage name value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set usage name value. + * + * @param value the value value to set + * @return the Name object itself. + */ + public Name withValue(String value) { + this.value = value; + return this; + } + + /** + * Get usage name localized value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set usage name localized value. + * + * @param localizedValue the localizedValue value to set + * @return the Name object itself. + */ + public Name withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnection.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..ece75b931d3dd --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnection.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.PrivateEndpointConnectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing PrivateEndpointConnection. + */ +public interface PrivateEndpointConnection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PrivateEndpointConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of PrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PrivateEndpointConnection definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the privateendpointconnection definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param serverName The name of the server + * @return the next definition stage + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the privateendpointconnection definition allowing to specify PrivateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies privateEndpoint. + * @param privateEndpoint Private endpoint which the connection belongs to + * @return the next definition stage + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + + /** + * The stage of the privateendpointconnection definition allowing to specify PrivateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies privateLinkServiceConnectionState. + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection + * @return the next definition stage + */ + WithCreate withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + } + } + /** + * The template for a PrivateEndpointConnection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + } + + /** + * Grouping of PrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the privateendpointconnection update allowing to specify PrivateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies privateEndpoint. + * @param privateEndpoint Private endpoint which the connection belongs to + * @return the next update stage + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + + /** + * The stage of the privateendpointconnection update allowing to specify PrivateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies privateLinkServiceConnectionState. + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection + * @return the next update stage + */ + Update withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnections.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..b3c62e7b4b6a2 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointConnections.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.PrivateEndpointConnectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections extends SupportsCreating, HasInner { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointProperty.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..07284fd41b8c7 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateEndpointProperty.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The PrivateEndpointProperty model. + */ +public class PrivateEndpointProperty { + /** + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get resource id of the private endpoint. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource id of the private endpoint. + * + * @param id the id value to set + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateLinkServiceConnectionStateProperty.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..73eee4cd10313 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The PrivateLinkServiceConnectionStateProperty model. + */ +public class PrivateLinkServiceConnectionStateProperty { + /** + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /** + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the private link service connection status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the private link service connection status. + * + * @param status the status value to set + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the private link service connection description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the private link service connection description. + * + * @param description the description value to set + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actions required for private link service connection. + * + * @return the actionsRequired value + */ + public String actionsRequired() { + return this.actionsRequired; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/RecommendedSensitivityLabels.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/RecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..41215ae3945dd --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/RecommendedSensitivityLabels.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing RecommendedSensitivityLabels. + */ +public interface RecommendedSensitivityLabels extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rank value. + */ + SensitivityLabelRank rank(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ReplicaType.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ReplicaType.java new file mode 100644 index 0000000000000..0d82dbd3a939c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ReplicaType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReplicaType. + */ +public final class ReplicaType extends ExpandableStringEnum { + /** Static value Primary for ReplicaType. */ + public static final ReplicaType PRIMARY = fromString("Primary"); + + /** Static value ReadableSecondary for ReplicaType. */ + public static final ReplicaType READABLE_SECONDARY = fromString("ReadableSecondary"); + + /** + * Creates or finds a ReplicaType from its string representation. + * @param name a name to look for + * @return the corresponding ReplicaType + */ + @JsonCreator + public static ReplicaType fromString(String name) { + return fromString(name, ReplicaType.class); + } + + /** + * @return known ReplicaType values + */ + public static Collection values() { + return values(ReplicaType.class); + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ResourceIdentity.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ResourceIdentity.java new file mode 100644 index 0000000000000..4c202dd46162e --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ResourceIdentity.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure Active Directory identity configuration for a resource. + */ +public class ResourceIdentity { + /** + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /** + * The identity type. Set this to 'SystemAssigned' in order to + * automatically create and assign an Azure Active Directory principal for + * the resource. Possible values include: 'SystemAssigned'. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /** + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Get the Azure Active Directory principal id. + * + * @return the principalId value + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned'. + * + * @return the type value + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned'. + * + * @param type the type value to set + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the Azure Active Directory tenant id. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SecurityAlertPolicyState.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..fa52e08846ba8 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SecurityAlertPolicyState.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyState. + */ +public enum SecurityAlertPolicyState { + /** Enum value New. */ + NEW("New"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyState instance. */ + private String value; + + SecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyState fromString(String value) { + SecurityAlertPolicyState[] items = SecurityAlertPolicyState.values(); + for (SecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelRank.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelRank.java new file mode 100644 index 0000000000000..78347eae376ff --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelRank.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SensitivityLabelRank. + */ +public enum SensitivityLabelRank { + /** Enum value None. */ + NONE("None"), + + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"), + + /** Enum value Critical. */ + CRITICAL("Critical"); + + /** The actual serialized value for a SensitivityLabelRank instance. */ + private String value; + + SensitivityLabelRank(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelRank instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelRank object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelRank fromString(String value) { + SensitivityLabelRank[] items = SensitivityLabelRank.values(); + for (SensitivityLabelRank item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelSource.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelSource.java new file mode 100644 index 0000000000000..301b2f6fa575d --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabelSource.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SensitivityLabelSource. + */ +public enum SensitivityLabelSource { + /** Enum value current. */ + CURRENT("current"), + + /** Enum value recommended. */ + RECOMMENDED("recommended"); + + /** The actual serialized value for a SensitivityLabelSource instance. */ + private String value; + + SensitivityLabelSource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelSource instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelSource object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelSource fromString(String value) { + SensitivityLabelSource[] items = SensitivityLabelSource.values(); + for (SensitivityLabelSource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabels.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabels.java new file mode 100644 index 0000000000000..a7ab9771a8a69 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/SensitivityLabels.java @@ -0,0 +1,242 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing SensitivityLabels. + */ +public interface SensitivityLabels extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rank value. + */ + SensitivityLabelRank rank(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SensitivityLabels definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithColumn, DefinitionStages.WithCreate { + } + + /** + * Grouping of SensitivityLabels definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SensitivityLabels definition. + */ + interface Blank extends WithColumn { + } + + /** + * The stage of the sensitivitylabels definition allowing to specify Column. + */ + interface WithColumn { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param managedInstanceName The name of the managed instance + * @param databaseName The name of the database + * @param schemaName The name of the schema + * @param tableName The name of the table + * @param columnName The name of the column + * @return the next definition stage + */ + WithCreate withExistingColumn(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName); + } + + /** + * The stage of the sensitivitylabels definition allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + * @param informationType The information type + * @return the next definition stage + */ + WithCreate withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabels definition allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + * @param informationTypeId The information type ID + * @return the next definition stage + */ + WithCreate withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabels definition allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + * @param labelId The label ID + * @return the next definition stage + */ + WithCreate withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabels definition allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + * @param labelName The label name + * @return the next definition stage + */ + WithCreate withLabelName(String labelName); + } + + /** + * The stage of the sensitivitylabels definition allowing to specify Rank. + */ + interface WithRank { + /** + * Specifies rank. + * @param rank Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical' + * @return the next definition stage + */ + WithCreate withRank(SensitivityLabelRank rank); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithInformationType, DefinitionStages.WithInformationTypeId, DefinitionStages.WithLabelId, DefinitionStages.WithLabelName, DefinitionStages.WithRank { + } + } + /** + * The template for a SensitivityLabels update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithInformationType, UpdateStages.WithInformationTypeId, UpdateStages.WithLabelId, UpdateStages.WithLabelName, UpdateStages.WithRank { + } + + /** + * Grouping of SensitivityLabels update stages. + */ + interface UpdateStages { + /** + * The stage of the sensitivitylabels update allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + * @param informationType The information type + * @return the next update stage + */ + Update withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabels update allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + * @param informationTypeId The information type ID + * @return the next update stage + */ + Update withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabels update allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + * @param labelId The label ID + * @return the next update stage + */ + Update withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabels update allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + * @param labelName The label name + * @return the next update stage + */ + Update withLabelName(String labelName); + } + + /** + * The stage of the sensitivitylabels update allowing to specify Rank. + */ + interface WithRank { + /** + * Specifies rank. + * @param rank Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical' + * @return the next update stage + */ + Update withRank(SensitivityLabelRank rank); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrator.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrator.java new file mode 100644 index 0000000000000..96bf778690dca --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrator.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.ServerAzureADAdministratorInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing ServerAzureADAdministrator. + */ +public interface ServerAzureADAdministrator extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the administratorType value. + */ + String administratorType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the login value. + */ + String login(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sid value. + */ + UUID sid(); + + /** + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerAzureADAdministrator definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithAdministratorType, DefinitionStages.WithLogin, DefinitionStages.WithSid, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerAzureADAdministrator definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerAzureADAdministrator definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param serverName The name of the server + * @return the next definition stage + */ + WithAdministratorType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify AdministratorType. + */ + interface WithAdministratorType { + /** + * Specifies administratorType. + * @param administratorType Type of the sever administrator + * @return the next definition stage + */ + WithLogin withAdministratorType(String administratorType); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Login. + */ + interface WithLogin { + /** + * Specifies login. + * @param login Login name of the server administrator + * @return the next definition stage + */ + WithSid withLogin(String login); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Sid. + */ + interface WithSid { + /** + * Specifies sid. + * @param sid SID (object ID) of the server administrator + * @return the next definition stage + */ + WithCreate withSid(UUID sid); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify TenantId. + */ + interface WithTenantId { + /** + * Specifies tenantId. + * @param tenantId Tenant ID of the administrator + * @return the next definition stage + */ + WithCreate withTenantId(UUID tenantId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTenantId { + } + } + /** + * The template for a ServerAzureADAdministrator update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTenantId { + } + + /** + * Grouping of ServerAzureADAdministrator update stages. + */ + interface UpdateStages { + /** + * The stage of the serverazureadadministrator update allowing to specify TenantId. + */ + interface WithTenantId { + /** + * Specifies tenantId. + * @param tenantId Tenant ID of the administrator + * @return the next update stage + */ + Update withTenantId(UUID tenantId); + } + + } +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrators.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrators.java new file mode 100644 index 0000000000000..91b49528b80a9 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerAzureADAdministrators.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrator; +import rx.Completable; + +/** + * Type representing ServerAzureADAdministrators. + */ +public interface ServerAzureADAdministrators { + /** + * Begins definition for a new Administrator resource. + * @param name resource name. + * @return the first stage of the new Administrator definition. + */ + ServerAzureADAdministrator.DefinitionStages.Blank defineAdministrator(String name); + + /** + * Gets a server Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + + /** + * Gets a list of server Administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java index 250075f1afd5a..a6fc12a888aa7 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java @@ -128,7 +128,7 @@ interface WithStorageAccountAccessKey { interface WithStorageContainerSasKey { /** * Specifies storageContainerSasKey. - * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required * @return the next definition stage */ WithCreate withStorageContainerSasKey(String storageContainerSasKey); @@ -182,7 +182,7 @@ interface WithStorageAccountAccessKey { interface WithStorageContainerSasKey { /** * Specifies storageContainerSasKey. - * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required * @return the next update stage */ Update withStorageContainerSasKey(String storageContainerSasKey); diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java new file mode 100644 index 0000000000000..09967f6b70bea --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An ARM Resource SKU. + */ +public class Sku { + /** + * The name of the SKU, typically, a letter + Number code, e.g. P3. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The tier or edition of the particular SKU, e.g. Basic, Premium. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * Size of the particular SKU. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * Capacity of the particular SKU. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get size of the particular SKU. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set size of the particular SKU. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get capacity of the particular SKU. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set capacity of the particular SKU. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationParameters.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationParameters.java new file mode 100644 index 0000000000000..452ff4117735d --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationParameters.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The UpsertManagedServerOperationParameters model. + */ +public class UpsertManagedServerOperationParameters { + /** + * The family property. + */ + @JsonProperty(value = "family") + private String family; + + /** + * The tier property. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The vCores property. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /** + * The storageSizeInGB property. + */ + @JsonProperty(value = "storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Get the family value. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set the family value. + * + * @param family the family value to set + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the tier value. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier value. + * + * @param tier the tier value to set + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the vCores value. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores value. + * + * @param vCores the vCores value to set + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB value. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB value. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationStep.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationStep.java new file mode 100644 index 0000000000000..fdb943398e72c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/UpsertManagedServerOperationStep.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The UpsertManagedServerOperationStep model. + */ +public class UpsertManagedServerOperationStep { + /** + * The order property. + */ + @JsonProperty(value = "order") + private Integer order; + + /** + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Possible values include: 'NotStarted', 'InProgress', 'SlowedDown', + * 'Completed', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Get the order value. + * + * @return the order value + */ + public Integer order() { + return this.order; + } + + /** + * Set the order value. + * + * @param order the order value to set + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withName(String name) { + this.name = name; + return this; + } + + /** + * Get possible values include: 'NotStarted', 'InProgress', 'SlowedDown', 'Completed', 'Failed', 'Canceled'. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set possible values include: 'NotStarted', 'InProgress', 'SlowedDown', 'Completed', 'Failed', 'Canceled'. + * + * @param status the status value to set + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withStatus(String status) { + this.status = status; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java new file mode 100644 index 0000000000000..7516b2e6969de --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing Usage. + */ +public interface Usage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + Name name(); + + /** + * @return the requestedLimit value. + */ + Integer requestedLimit(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java new file mode 100644 index 0000000000000..151a067572bf0 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.UsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Usages. + */ +public interface Usages extends HasInner { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName); + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/CurrentSensitivityLabelsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/CurrentSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..702368f4537cf --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/CurrentSensitivityLabelsImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.CurrentSensitivityLabels; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabelRank; + +class CurrentSensitivityLabelsImpl extends WrapperImpl implements CurrentSensitivityLabels { + private final SqlManager manager; + + CurrentSensitivityLabelsImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SensitivityLabelRank rank() { + return this.inner().rank(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..b37788b4b0bd9 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicy; + +class DatabaseSecurityAlertPoliciesImpl extends WrapperImpl implements DatabaseSecurityAlertPolicies { + private final SqlManager manager; + + DatabaseSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseSecurityAlertPolicyImpl wrapModel(DatabaseSecurityAlertPolicyInner inner) { + return new DatabaseSecurityAlertPolicyImpl(inner, manager()); + } + + private DatabaseSecurityAlertPolicyImpl wrapModel(String name) { + return new DatabaseSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabaseSecurityAlertPolicy call(DatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(DatabaseSecurityAlertPolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DatabaseSecurityAlertPolicy)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..e9345212db2fe --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPoliciesInner.java @@ -0,0 +1,520 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseSecurityAlertPolicies. + */ +public class DatabaseSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseSecurityAlertPolicyInner object if successful. + */ + public DatabaseSecurityAlertPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseSecurityAlertPolicyInner>() { + @Override + public DatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String securityAlertPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseSecurityAlertPolicyInner object if successful. + */ + public DatabaseSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseSecurityAlertPolicyInner>() { + @Override + public DatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String securityAlertPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatabaseSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseSecurityAlertPolicyInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseSecurityAlertPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of database's security alert policies. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of database's security alert policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatabaseSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of database's security alert policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of database's security alert policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseSecurityAlertPolicyInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database's security alert policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseSecurityAlertPolicyInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of database's security alert policies. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..4220fd931d06a --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class DatabaseSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements DatabaseSecurityAlertPolicy, DatabaseSecurityAlertPolicy.Definition, DatabaseSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseSecurityAlertPolicyImpl(DatabaseSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseSecurityAlertPoliciesInner client = this.manager().inner().databaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseSecurityAlertPoliciesInner client = this.manager().inner().databaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseSecurityAlertPoliciesInner client = this.manager().inner().databaseSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public Boolean emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public List emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public SecurityAlertPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseSecurityAlertPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..7522756e66f04 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,227 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database security alert policy. + */ +@JsonFlatten +public class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. Possible + * values include: 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /** + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..7ece6f3b0668c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Databases; +import rx.Completable; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final SqlManager manager; + + DatabasesImpl(SqlManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..e39e08b24f59d --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/DatabasesInner.java @@ -0,0 +1,402 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ReplicaType; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.Databases failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("replicaType") ReplicaType replicaType, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.Databases beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("replicaType") ReplicaType replicaType, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void failover(String resourceGroupName, String serverName, String databaseName) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failoverAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String databaseName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final ReplicaType replicaType = null; + Observable> observable = service.failover(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), replicaType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType).toBlocking().last().body(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failoverAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType), serviceCallback); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.failover(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), replicaType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginFailover(String resourceGroupName, String serverName, String databaseName) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String databaseName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final ReplicaType replicaType = null; + return service.beginFailover(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), replicaType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginFailover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType).toBlocking().single().body(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType), serviceCallback); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, replicaType).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. Possible values include: 'Primary', 'ReadableSecondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginFailover(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), replicaType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..509bae958021e --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ElasticPools; +import rx.Completable; + +class ElasticPoolsImpl extends WrapperImpl implements ElasticPools { + private final SqlManager manager; + + ElasticPoolsImpl(SqlManager manager) { + super(manager.inner().elasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..f8e07f0f24477 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ElasticPoolsInner.java @@ -0,0 +1,232 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPools. + */ +public class ElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ElasticPools failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ElasticPools beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void failover(String resourceGroupName, String serverName, String elasticPoolName) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().last().body(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failoverAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.failover(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginFailover(String resourceGroupName, String serverName, String elasticPoolName) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFailoverAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginFailover(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java new file mode 100644 index 0000000000000..a6ded2aa863a6 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePool; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePoolLicenseType; + +class InstancePoolImpl extends GroupableResourceCoreImpl implements InstancePool, InstancePool.Definition, InstancePool.Update { + InstancePoolImpl(String name, InstancePoolInner inner, SqlManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public InstancePoolLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public int vCores() { + return this.inner().vCores(); + } + + @Override + public InstancePoolImpl withLicenseType(InstancePoolLicenseType licenseType) { + this.inner().withLicenseType(licenseType); + return this; + } + + @Override + public InstancePoolImpl withSubnetId(String subnetId) { + this.inner().withSubnetId(subnetId); + return this; + } + + @Override + public InstancePoolImpl withVCores(int vCores) { + this.inner().withVCores(vCores); + return this; + } + + @Override + public InstancePoolImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java new file mode 100644 index 0000000000000..f231e9b422430 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL instance pool. + */ +@JsonFlatten +public class InstancePoolInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Resource ID of the subnet to place this instance pool in. + */ + @JsonProperty(value = "properties.subnetId", required = true) + private String subnetId; + + /** + * Count of vCores belonging to this instance pool. + */ + @JsonProperty(value = "properties.vCores", required = true) + private int vCores; + + /** + * The license type. Possible values are 'LicenseIncluded' (price for SQL + * license is included) and 'BasePrice' (without SQL license price). + * Possible values include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType", required = true) + private InstancePoolLicenseType licenseType; + + /** + * Get the name and tier of the SKU. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the name and tier of the SKU. + * + * @param sku the sku value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set resource ID of the subnet to place this instance pool in. + * + * @param subnetId the subnetId value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get count of vCores belonging to this instance pool. + * + * @return the vCores value + */ + public int vCores() { + return this.vCores; + } + + /** + * Set count of vCores belonging to this instance pool. + * + * @param vCores the vCores value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withVCores(int vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public InstancePoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withLicenseType(InstancePoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java new file mode 100644 index 0000000000000..6f4c47403ce12 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePool; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class InstancePoolsImpl extends GroupableResourcesCoreImpl implements InstancePools { + protected InstancePoolsImpl(SqlManager manager) { + super(manager.inner().instancePools(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + InstancePoolsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + InstancePoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + InstancePoolsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + InstancePoolsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstancePool call(InstancePoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + InstancePoolsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + InstancePoolsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstancePool call(InstancePoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public InstancePoolImpl define(String name) { + return wrapModel(name); + } + + @Override + protected InstancePoolImpl wrapModel(InstancePoolInner inner) { + return new InstancePoolImpl(inner.name(), inner, manager()); + } + + @Override + protected InstancePoolImpl wrapModel(String name) { + return new InstancePoolImpl(name, new InstancePoolInner(), this.manager()); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java new file mode 100644 index 0000000000000..f2c2f6a468c26 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java @@ -0,0 +1,1297 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePoolUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in InstancePools. + */ +public class InstancePoolsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private InstancePoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstancePoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstancePoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstancePoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstancePools to be + * used by Retrofit to perform actually REST calls. + */ + interface InstancePoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Body InstancePoolInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Body InstancePoolInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InstancePoolUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InstancePoolUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner createOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner beginCreateOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String instancePoolName) { + deleteWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().last().body(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String instancePoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String instancePoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String instancePoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner update(String resourceGroupName, String instancePoolName) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().last().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String instancePoolName) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(null); + Observable> observable = service.update(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner update(String resourceGroupName, String instancePoolName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).toBlocking().last().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String instancePoolName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String instancePoolName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner beginUpdate(String resourceGroupName, String instancePoolName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String instancePoolName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(null); + return service.beginUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstancePoolInner object if successful. + */ + public InstancePoolInner beginUpdate(String resourceGroupName, String instancePoolName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).toBlocking().single().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String instancePoolName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String instancePoolName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(tags); + return service.beginUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstancePoolInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of instance pools in the resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstancePoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstancePoolInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstancePoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstancePoolInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of instance pools in the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstancePoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstancePoolInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all instance pools in the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstancePoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsImpl.java new file mode 100644 index 0000000000000..ffef0103dd077 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsImpl.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionBackup; + +class LongTermRetentionManagedInstanceBackupsImpl extends WrapperImpl implements LongTermRetentionManagedInstanceBackups { + private final SqlManager manager; + + LongTermRetentionManagedInstanceBackupsImpl(SqlManager manager) { + super(manager.inner().longTermRetentionManagedInstanceBackups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedInstanceLongTermRetentionBackupImpl wrapModel(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + + @Override + public Observable listByInstanceAsync(final String locationName, final String managedInstanceName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByInstanceAsync(locationName, managedInstanceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByLocationAsync(final String locationName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByLocationAsync(locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.deleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).toCompletable(); + } + + @Override + public Observable listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByResourceGroupDatabaseAsync(resourceGroupName, locationName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByResourceGroupInstanceAsync(resourceGroupName, locationName, managedInstanceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByResourceGroupLocationAsync(resourceGroupName, locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.listByDatabaseAsync(locationName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionBackup call(ManagedInstanceLongTermRetentionBackupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.getAsync(locationName, managedInstanceName, databaseName, backupName) + .flatMap(new Func1>() { + @Override + public Observable call(ManagedInstanceLongTermRetentionBackupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedInstanceLongTermRetentionBackup)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + LongTermRetentionManagedInstanceBackupsInner client = this.inner(); + return client.deleteAsync(locationName, managedInstanceName, databaseName, backupName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsInner.java new file mode 100644 index 0000000000000..82627c36b9a7c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/LongTermRetentionManagedInstanceBackupsInner.java @@ -0,0 +1,2941 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseState; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LongTermRetentionManagedInstanceBackups. + */ +public class LongTermRetentionManagedInstanceBackupsInner { + /** The Retrofit service to perform REST calls. */ + private LongTermRetentionManagedInstanceBackupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionManagedInstanceBackupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LongTermRetentionManagedInstanceBackupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(LongTermRetentionManagedInstanceBackupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LongTermRetentionManagedInstanceBackups to be + * used by Retrofit to perform actually REST calls. + */ + interface LongTermRetentionManagedInstanceBackupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + Observable> get(@Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups") + Observable> listByDatabase(@Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByInstance" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups") + Observable> listByInstance(@Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups deleteByResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> deleteByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups beginDeleteByResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDeleteByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups") + Observable> listByResourceGroupDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups") + Observable> listByResourceGroupInstance(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups") + Observable> listByResourceGroupLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupDatabaseNext" }) + @GET + Observable> listByResourceGroupDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupInstanceNext" }) + @GET + Observable> listByResourceGroupInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups listByResourceGroupLocationNext" }) + @GET + Observable> listByResourceGroupLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceLongTermRetentionBackupInner object if successful. + */ + public ManagedInstanceLongTermRetentionBackupInner get(String locationName, String managedInstanceName, String databaseName, String backupName) { + return getWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionBackupInner object + */ + public Observable getAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + return getWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).map(new Func1, ManagedInstanceLongTermRetentionBackupInner>() { + @Override + public ManagedInstanceLongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionBackupInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String locationName, String managedInstanceName, String databaseName, String backupName) { + deleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + return deleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String locationName, String managedInstanceName, String databaseName, String backupName) { + beginDeleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteWithServiceResponseAsync(locationName, managedInstanceName, databaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String locationName, String managedInstanceName, String databaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(locationName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String managedInstanceName, final String databaseName) { + return listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String managedInstanceName, final String databaseName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByDatabase(locationName, managedInstanceName, databaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByDatabaseWithServiceResponseAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByDatabaseSinglePageAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + ServiceResponse> * @param locationName The location of the database. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the managed database. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(locationName, managedInstanceName, databaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByInstance(final String locationName, final String managedInstanceName) { + ServiceResponse> response = listByInstanceSinglePageAsync(locationName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceAsync(final String locationName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(locationName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByInstanceAsync(final String locationName, final String managedInstanceName) { + return listByInstanceWithServiceResponseAsync(locationName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String locationName, final String managedInstanceName) { + return listByInstanceSinglePageAsync(locationName, managedInstanceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String locationName, final String managedInstanceName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByInstance(locationName, managedInstanceName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByInstance(final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceAsync(final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByInstanceAsync(final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByInstanceWithServiceResponseAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInstance(locationName, managedInstanceName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName) { + return listByLocationWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName) { + return listByLocationSinglePageAsync(locationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByLocationWithServiceResponseAsync(locationName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + ServiceResponse> * @param locationName The location of the database. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceLongTermRetentionBackupInner object if successful. + */ + public ManagedInstanceLongTermRetentionBackupInner getByResourceGroup(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionBackupInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).map(new Func1, ManagedInstanceLongTermRetentionBackupInner>() { + @Override + public ManagedInstanceLongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionBackupInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteByResourceGroup(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + deleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + return deleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteByResourceGroup(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteByResourceGroupAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String managedInstanceName, String databaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupDatabase(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName) { + return listByResourceGroupDatabaseWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupDatabaseWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName) { + return listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupDatabaseSinglePageAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByResourceGroupDatabase(resourceGroupName, locationName, managedInstanceName, databaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupDatabase(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupDatabaseWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupDatabaseWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the managed database. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupDatabaseSinglePageAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final String databaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroupDatabase(resourceGroupName, locationName, managedInstanceName, databaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupInstance(final String resourceGroupName, final String locationName, final String managedInstanceName) { + ServiceResponse> response = listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName) { + return listByResourceGroupInstanceWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupInstanceWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName) { + return listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupInstanceSinglePageAsync(final String resourceGroupName, final String locationName, final String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByResourceGroupInstance(resourceGroupName, locationName, managedInstanceName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupInstance(final String resourceGroupName, final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupInstanceAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupInstanceWithServiceResponseAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupInstanceWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupInstanceSinglePageAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param locationName The location of the database. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupInstanceSinglePageAsync(final String resourceGroupName, final String locationName, final String managedInstanceName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroupInstance(resourceGroupName, locationName, managedInstanceName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupInstanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName) { + return listByResourceGroupLocationWithServiceResponseAsync(resourceGroupName, locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupLocationSinglePageAsync(final String resourceGroupName, final String locationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByResourceGroupLocation(resourceGroupName, locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupLocation(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupLocationWithServiceResponseAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param locationName The location of the database. + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupLocationSinglePageAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroupLocation(resourceGroupName, locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupDatabaseNextAsync(final String nextPageLink) { + return listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a managed database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupInstanceNextAsync(final String nextPageLink) { + return listByResourceGroupInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupInstanceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupInstanceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupInstanceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupLocationNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupLocationNextAsync(final String nextPageLink) { + return listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupLocationNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseImpl.java new file mode 100644 index 0000000000000..1d32c64fae30e --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseImpl.java @@ -0,0 +1,322 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabase; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseUpdate; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseStatus; +import com.microsoft.azure.management.sql.v2018_06_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseCreateMode; +import rx.functions.Func1; + +class ManagedDatabaseImpl extends CreatableUpdatableImpl implements ManagedDatabase, ManagedDatabase.Definition, ManagedDatabase.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private ManagedDatabaseUpdate updateParameter; + + ManagedDatabaseImpl(String name, SqlManager manager) { + super(name, new ManagedDatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new ManagedDatabaseUpdate(); + } + + ManagedDatabaseImpl(ManagedDatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new ManagedDatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabasesInner client = this.manager().inner().managedDatabases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public ManagedDatabaseInner call(ManagedDatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabasesInner client = this.manager().inner().managedDatabases(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public ManagedDatabaseInner call(ManagedDatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabasesInner client = this.manager().inner().managedDatabases(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ManagedDatabaseUpdate(); + } + + @Override + public CatalogCollationType catalogCollation() { + return this.inner().catalogCollation(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public ManagedDatabaseCreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestorePoint() { + return this.inner().earliestRestorePoint(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String longTermRetentionBackupResourceId() { + return this.inner().longTermRetentionBackupResourceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public ManagedDatabaseStatus status() { + return this.inner().status(); + } + + @Override + public String storageContainerSasToken() { + return this.inner().storageContainerSasToken(); + } + + @Override + public String storageContainerUri() { + return this.inner().storageContainerUri(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedDatabaseImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedDatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ManagedDatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.inner().withCatalogCollation(catalogCollation); + } else { + this.updateParameter.withCatalogCollation(catalogCollation); + } + return this; + } + + @Override + public ManagedDatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public ManagedDatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.inner().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } else { + this.updateParameter.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } + return this; + } + + @Override + public ManagedDatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public ManagedDatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + + @Override + public ManagedDatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public ManagedDatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public ManagedDatabaseImpl withStorageContainerSasToken(String storageContainerSasToken) { + if (isInCreateMode()) { + this.inner().withStorageContainerSasToken(storageContainerSasToken); + } else { + this.updateParameter.withStorageContainerSasToken(storageContainerSasToken); + } + return this; + } + + @Override + public ManagedDatabaseImpl withStorageContainerUri(String storageContainerUri) { + if (isInCreateMode()) { + this.inner().withStorageContainerUri(storageContainerUri); + } else { + this.updateParameter.withStorageContainerUri(storageContainerUri); + } + return this; + } + + @Override + public ManagedDatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseInner.java new file mode 100644 index 0000000000000..ef9b82b6fa3f4 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseInner.java @@ -0,0 +1,380 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2018_06_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseCreateMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A managed database resource. + */ +@JsonFlatten +public class ManagedDatabaseInner extends Resource { + /** + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Status of the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /** + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestorePoint; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Recovery: Creates a database + * by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. Possible + * values include: 'Default', 'RestoreExternalBackup', + * 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /** + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The name of the Long Term Retention backup to be used for restore of + * this managed database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * Get collation of the managed database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set collation of the managed database. + * + * @param collation the collation value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating'. + * + * @return the status value + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get creation date of the database. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value + */ + public DateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get geo paired region. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @param catalogCollation the catalogCollation value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @return the storageContainerUri value + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @param storageContainerUri the storageContainerUri value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the resource identifier of the source database associated with create operation of this database. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the resource identifier of the source database associated with create operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorable dropped database resource id to restore when creating this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorable dropped database resource id to restore when creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. + * + * @return the storageContainerSasToken value + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. + * + * @param storageContainerSasToken the storageContainerSasToken value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get instance Failover Group resource identifier that this managed database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the resource identifier of the recoverable database associated with create operation of this database. + * + * @return the recoverableDatabaseId value + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the resource identifier of the recoverable database associated with create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the name of the Long Term Retention backup to be used for restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the name of the Long Term Retention backup to be used for restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsImpl.java new file mode 100644 index 0000000000000..56d45da833107 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseRestoreDetails; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseRestoreDetailsResult; + +class ManagedDatabaseRestoreDetailsImpl extends WrapperImpl implements ManagedDatabaseRestoreDetails { + private final SqlManager manager; + + ManagedDatabaseRestoreDetailsImpl(SqlManager manager) { + super(manager.inner().managedDatabaseRestoreDetails()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedDatabaseRestoreDetailsResultImpl wrapModel(ManagedDatabaseRestoreDetailsResultInner inner) { + return new ManagedDatabaseRestoreDetailsResultImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseRestoreDetailsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(ManagedDatabaseRestoreDetailsResultInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedDatabaseRestoreDetailsResult)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsInner.java new file mode 100644 index 0000000000000..a9d5a1885b8d7 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsInner.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseRestoreDetails. + */ +public class ManagedDatabaseRestoreDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseRestoreDetailsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseRestoreDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseRestoreDetailsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseRestoreDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseRestoreDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseRestoreDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseRestoreDetails get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("restoreDetailsName") String restoreDetailsName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseRestoreDetailsResultInner object if successful. + */ + public ManagedDatabaseRestoreDetailsResultInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseRestoreDetailsResultInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseRestoreDetailsResultInner>() { + @Override + public ManagedDatabaseRestoreDetailsResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseRestoreDetailsResultInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String restoreDetailsName = "Default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultImpl.java new file mode 100644 index 0000000000000..739ee934063e1 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultImpl.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseRestoreDetailsResult; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; + +class ManagedDatabaseRestoreDetailsResultImpl extends IndexableRefreshableWrapperImpl implements ManagedDatabaseRestoreDetailsResult { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedDatabaseRestoreDetailsResultImpl(ManagedDatabaseRestoreDetailsResultInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseRestoreDetailsInner client = this.manager().inner().managedDatabaseRestoreDetails(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + + + @Override + public String blockReason() { + return this.inner().blockReason(); + } + + @Override + public String currentRestoringFileName() { + return this.inner().currentRestoringFileName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastRestoredFileName() { + return this.inner().lastRestoredFileName(); + } + + @Override + public DateTime lastRestoredFileTime() { + return this.inner().lastRestoredFileTime(); + } + + @Override + public String lastUploadedFileName() { + return this.inner().lastUploadedFileName(); + } + + @Override + public DateTime lastUploadedFileTime() { + return this.inner().lastUploadedFileTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Long numberOfFilesDetected() { + return this.inner().numberOfFilesDetected(); + } + + @Override + public Double percentCompleted() { + return this.inner().percentCompleted(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List unrestorableFiles() { + return this.inner().unrestorableFiles(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultInner.java new file mode 100644 index 0000000000000..674e3e405a88f --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseRestoreDetailsResultInner.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed database restore details. + */ +@JsonFlatten +public class ManagedDatabaseRestoreDetailsResultInner extends ProxyResource { + /** + * Restore status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Current restoring file name. + */ + @JsonProperty(value = "properties.currentRestoringFileName", access = JsonProperty.Access.WRITE_ONLY) + private String currentRestoringFileName; + + /** + * Last restored file name. + */ + @JsonProperty(value = "properties.lastRestoredFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastRestoredFileName; + + /** + * Last restored file time. + */ + @JsonProperty(value = "properties.lastRestoredFileTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastRestoredFileTime; + + /** + * Percent completed. + */ + @JsonProperty(value = "properties.percentCompleted", access = JsonProperty.Access.WRITE_ONLY) + private Double percentCompleted; + + /** + * List of unrestorable files. + */ + @JsonProperty(value = "properties.unrestorableFiles", access = JsonProperty.Access.WRITE_ONLY) + private List unrestorableFiles; + + /** + * Number of files detected. + */ + @JsonProperty(value = "properties.numberOfFilesDetected", access = JsonProperty.Access.WRITE_ONLY) + private Long numberOfFilesDetected; + + /** + * Last uploaded file name. + */ + @JsonProperty(value = "properties.lastUploadedFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastUploadedFileName; + + /** + * Last uploaded file time. + */ + @JsonProperty(value = "properties.lastUploadedFileTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUploadedFileTime; + + /** + * The reason why restore is in Blocked state. + */ + @JsonProperty(value = "properties.blockReason", access = JsonProperty.Access.WRITE_ONLY) + private String blockReason; + + /** + * Get restore status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get current restoring file name. + * + * @return the currentRestoringFileName value + */ + public String currentRestoringFileName() { + return this.currentRestoringFileName; + } + + /** + * Get last restored file name. + * + * @return the lastRestoredFileName value + */ + public String lastRestoredFileName() { + return this.lastRestoredFileName; + } + + /** + * Get last restored file time. + * + * @return the lastRestoredFileTime value + */ + public DateTime lastRestoredFileTime() { + return this.lastRestoredFileTime; + } + + /** + * Get percent completed. + * + * @return the percentCompleted value + */ + public Double percentCompleted() { + return this.percentCompleted; + } + + /** + * Get list of unrestorable files. + * + * @return the unrestorableFiles value + */ + public List unrestorableFiles() { + return this.unrestorableFiles; + } + + /** + * Get number of files detected. + * + * @return the numberOfFilesDetected value + */ + public Long numberOfFilesDetected() { + return this.numberOfFilesDetected; + } + + /** + * Get last uploaded file name. + * + * @return the lastUploadedFileName value + */ + public String lastUploadedFileName() { + return this.lastUploadedFileName; + } + + /** + * Get last uploaded file time. + * + * @return the lastUploadedFileTime value + */ + public DateTime lastUploadedFileTime() { + return this.lastUploadedFileTime; + } + + /** + * Get the reason why restore is in Blocked state. + * + * @return the blockReason value + */ + public String blockReason() { + return this.blockReason; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..233c612ec3674 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsImpl.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabels; +import rx.Completable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.CurrentSensitivityLabels; +import com.microsoft.azure.management.sql.v2018_06_01_preview.RecommendedSensitivityLabels; + +class ManagedDatabaseSensitivityLabelsImpl extends WrapperImpl implements ManagedDatabaseSensitivityLabels { + private final SqlManager manager; + + ManagedDatabaseSensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().managedDatabaseSensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SensitivityLabelsImpl defineSensitivityLabel(String name) { + return wrapSensitivityLabelModel(name); + } + + private SensitivityLabelsImpl wrapSensitivityLabelModel(String name) { + return new SensitivityLabelsImpl(name, this.manager()); + } + + private SensitivityLabelsImpl wrapSensitivityLabelsModel(SensitivityLabelInner inner) { + return new SensitivityLabelsImpl(inner, manager()); + } + + private CurrentSensitivityLabelsImpl wrapCurrentSensitivityLabelsModel(SensitivityLabelInner inner) { + return new CurrentSensitivityLabelsImpl(inner, manager()); + } + + private RecommendedSensitivityLabelsImpl wrapRecommendedSensitivityLabelsModel(SensitivityLabelInner inner) { + return new RecommendedSensitivityLabelsImpl(inner, manager()); + } + + private Observable getSensitivityLabelInnerUsingManagedDatabaseSensitivityLabelsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String schemaName = IdParsingUtils.getValueFromIdByName(id, "schemas"); + String tableName = IdParsingUtils.getValueFromIdByName(id, "tables"); + String columnName = IdParsingUtils.getValueFromIdByName(id, "columns"); + String sensitivityLabelSource = SensitivityLabelSource.valueOf(IdParsingUtils.getValueFromIdByName(id, "sensitivityLabels")); + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .flatMap(new Func1>() { + @Override + public Observable call(SensitivityLabelInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SensitivityLabels)wrapSensitivityLabelsModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + @Override + public Completable disableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.disableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + @Override + public Completable enableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.enableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + @Override + public Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.listCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CurrentSensitivityLabels call(SensitivityLabelInner inner) { + return wrapCurrentSensitivityLabelsModel(inner); + } + }); + } + + @Override + public Observable listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseSensitivityLabelsInner client = this.inner(); + return client.listRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RecommendedSensitivityLabels call(SensitivityLabelInner inner) { + return wrapRecommendedSensitivityLabelsModel(inner); + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsInner.java new file mode 100644 index 0000000000000..b423e135f8675 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabaseSensitivityLabelsInner.java @@ -0,0 +1,1447 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabelSource; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseSensitivityLabels. + */ +public class ManagedDatabaseSensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseSensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseSensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseSensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseSensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseSensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Body SensitivityLabelInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels disableRecommendation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable") + Observable> disableRecommendation(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels enableRecommendation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable") + Observable> enableRecommendation(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels listCurrentByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels") + Observable> listCurrentByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels listRecommendedByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels") + Observable> listRecommendedByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("includeDisabledRecommendations") Boolean includeDisabledRecommendations, @Query("$skipToken") String skipToken, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels listCurrentByDatabaseNext" }) + @GET + Observable> listCurrentByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels listRecommendedByDatabaseNext" }) + @GET + Observable> listRecommendedByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner get(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).toBlocking().single().body(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource), serviceCallback); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (sensitivityLabelSource == null) { + throw new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters), serviceCallback); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String sensitivityLabelSource = "current"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String sensitivityLabelSource = "current"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableRecommendation(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + disableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture disableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + return disableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableRecommendationWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String sensitivityLabelSource = "recommended"; + return service.disableRecommendation(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = disableRecommendationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableRecommendationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableRecommendation(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + enableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableRecommendationAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + return enableRecommendationWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableRecommendationWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String sensitivityLabelSource = "recommended"; + return service.enableRecommendation(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableRecommendationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableRecommendationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName, final String filter) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final String filter) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final String filter) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listRecommendedByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listRecommendedByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listRecommendedByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRecommendedByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return service.listRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRecommendedByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listRecommendedByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + ServiceResponse> response = listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listRecommendedByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + return listRecommendedByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listRecommendedByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + return listRecommendedByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + ServiceResponse> * @param skipToken the String value + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRecommendedByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRecommendedByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRecommendedByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listCurrentByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseNextAsync(final String nextPageLink) { + return listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listCurrentByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listRecommendedByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listRecommendedByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRecommendedByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listRecommendedByDatabaseNextAsync(final String nextPageLink) { + return listRecommendedByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listRecommendedByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listRecommendedByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRecommendedByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listRecommendedByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRecommendedByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRecommendedByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesImpl.java new file mode 100644 index 0000000000000..5f0dcc892b45b --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesImpl.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabase; +import com.microsoft.azure.Page; +import rx.Completable; + +class ManagedDatabasesImpl extends WrapperImpl implements ManagedDatabases { + private final SqlManager manager; + + ManagedDatabasesImpl(SqlManager manager) { + super(manager.inner().managedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedDatabaseImpl defineDatabasis(String name) { + return wrapDatabasisModel(name); + } + + private ManagedDatabaseImpl wrapDatabasisModel(String name) { + return new ManagedDatabaseImpl(name, this.manager()); + } + + private ManagedDatabaseImpl wrapManagedDatabaseModel(ManagedDatabaseInner inner) { + return new ManagedDatabaseImpl(inner, manager()); + } + + private Observable getManagedDatabaseInnerUsingManagedDatabasesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + ManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(ManagedDatabaseInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedDatabase)wrapManagedDatabaseModel(inner)); + } + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedDatabasesInner client = this.inner(); + return client.listByInstanceAsync(resourceGroupName, managedInstanceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedDatabase call(ManagedDatabaseInner inner) { + return wrapManagedDatabaseModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName).toCompletable(); + } + + @Override + public Completable completeRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + ManagedDatabasesInner client = this.inner(); + return client.completeRestoreAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesInner.java new file mode 100644 index 0000000000000..6905c8105afc9 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedDatabasesInner.java @@ -0,0 +1,1169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2018_06_01_preview.CompleteDatabaseRestoreDefinition; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabases. + */ +public class ManagedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases") + Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases completeRestore" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore") + Observable> completeRestore(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CompleteDatabaseRestoreDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases beginCompleteRestore" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore") + Observable> beginCompleteRestore(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CompleteDatabaseRestoreDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedDatabaseInner> object if successful. + */ + public PagedList listByInstance(final String resourceGroupName, final String managedInstanceName) { + ServiceResponse> response = listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed databases. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInstance(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String managedInstanceName, String databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner update(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void completeRestore(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + completeRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName).toBlocking().last().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture completeRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(completeRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable completeRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + return completeRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> completeRestoreWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + Observable> observable = service.completeRestore(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginCompleteRestore(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + beginCompleteRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName).toBlocking().single().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCompleteRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCompleteRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCompleteRestoreAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + return beginCompleteRestoreWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCompleteRestoreWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + return service.beginCompleteRestore(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCompleteRestoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCompleteRestoreDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedDatabaseInner> object if successful. + */ + public PagedList listByInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable>> listByInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed databases. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceImpl.java new file mode 100644 index 0000000000000..13c691ba4ad50 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceImpl.java @@ -0,0 +1,442 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstance; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceUpdate; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ResourceIdentity; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLicenseType; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceProxyOverride; +import rx.functions.Func1; + +class ManagedInstanceImpl extends CreatableUpdatableImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private ManagedInstanceUpdate updateParameter; + + ManagedInstanceImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + this.updateParameter = new ManagedInstanceUpdate(); + } + + ManagedInstanceImpl(ManagedInstanceInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + this.updateParameter = new ManagedInstanceUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstancesInner client = this.manager().inner().managedInstances(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(new Func1() { + @Override + public ManagedInstanceInner call(ManagedInstanceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstancesInner client = this.manager().inner().managedInstances(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.updateParameter) + .map(new Func1() { + @Override + public ManagedInstanceInner call(ManagedInstanceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstancesInner client = this.manager().inner().managedInstances(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ManagedInstanceUpdate(); + } + + @Override + public String administratorLogin() { + return this.inner().administratorLogin(); + } + + @Override + public String administratorLoginPassword() { + return this.inner().administratorLoginPassword(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public String dnsZone() { + return this.inner().dnsZone(); + } + + @Override + public String dnsZonePartner() { + return this.inner().dnsZonePartner(); + } + + @Override + public String fullyQualifiedDomainName() { + return this.inner().fullyQualifiedDomainName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public ResourceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String instancePoolId() { + return this.inner().instancePoolId(); + } + + @Override + public ManagedInstanceLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maintenanceConfigurationId() { + return this.inner().maintenanceConfigurationId(); + } + + @Override + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.inner().managedInstanceCreateMode(); + } + + @Override + public String minimalTlsVersion() { + return this.inner().minimalTlsVersion(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ManagedInstanceProxyOverride proxyOverride() { + return this.inner().proxyOverride(); + } + + @Override + public Boolean publicDataEndpointEnabled() { + return this.inner().publicDataEndpointEnabled(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public String sourceManagedInstanceId() { + return this.inner().sourceManagedInstanceId(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public Integer storageSizeInGB() { + return this.inner().storageSizeInGB(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String timezoneId() { + return this.inner().timezoneId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Integer vCores() { + return this.inner().vCores(); + } + + @Override + public ManagedInstanceImpl withExistingInstancePool(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public ManagedInstanceImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ManagedInstanceImpl withIdentity(ResourceIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ManagedInstanceImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.inner().withAdministratorLogin(administratorLogin); + } else { + this.updateParameter.withAdministratorLogin(administratorLogin); + } + return this; + } + + @Override + public ManagedInstanceImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.inner().withAdministratorLoginPassword(administratorLoginPassword); + } else { + this.updateParameter.withAdministratorLoginPassword(administratorLoginPassword); + } + return this; + } + + @Override + public ManagedInstanceImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { + if (isInCreateMode()) { + this.inner().withDnsZonePartner(dnsZonePartner); + } else { + this.updateParameter.withDnsZonePartner(dnsZonePartner); + } + return this; + } + + @Override + public ManagedInstanceImpl withInstancePoolId(String instancePoolId) { + if (isInCreateMode()) { + this.inner().withInstancePoolId(instancePoolId); + } else { + this.updateParameter.withInstancePoolId(instancePoolId); + } + return this; + } + + @Override + public ManagedInstanceImpl withLicenseType(ManagedInstanceLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ManagedInstanceImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.inner().withMaintenanceConfigurationId(maintenanceConfigurationId); + } else { + this.updateParameter.withMaintenanceConfigurationId(maintenanceConfigurationId); + } + return this; + } + + @Override + public ManagedInstanceImpl withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (isInCreateMode()) { + this.inner().withManagedInstanceCreateMode(managedInstanceCreateMode); + } else { + this.updateParameter.withManagedInstanceCreateMode(managedInstanceCreateMode); + } + return this; + } + + @Override + public ManagedInstanceImpl withMinimalTlsVersion(String minimalTlsVersion) { + if (isInCreateMode()) { + this.inner().withMinimalTlsVersion(minimalTlsVersion); + } else { + this.updateParameter.withMinimalTlsVersion(minimalTlsVersion); + } + return this; + } + + @Override + public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (isInCreateMode()) { + this.inner().withProxyOverride(proxyOverride); + } else { + this.updateParameter.withProxyOverride(proxyOverride); + } + return this; + } + + @Override + public ManagedInstanceImpl withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + if (isInCreateMode()) { + this.inner().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + } else { + this.updateParameter.withPublicDataEndpointEnabled(publicDataEndpointEnabled); + } + return this; + } + + @Override + public ManagedInstanceImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public ManagedInstanceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public ManagedInstanceImpl withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (isInCreateMode()) { + this.inner().withSourceManagedInstanceId(sourceManagedInstanceId); + } else { + this.updateParameter.withSourceManagedInstanceId(sourceManagedInstanceId); + } + return this; + } + + @Override + public ManagedInstanceImpl withStorageSizeInGB(Integer storageSizeInGB) { + if (isInCreateMode()) { + this.inner().withStorageSizeInGB(storageSizeInGB); + } else { + this.updateParameter.withStorageSizeInGB(storageSizeInGB); + } + return this; + } + + @Override + public ManagedInstanceImpl withSubnetId(String subnetId) { + if (isInCreateMode()) { + this.inner().withSubnetId(subnetId); + } else { + this.updateParameter.withSubnetId(subnetId); + } + return this; + } + + @Override + public ManagedInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ManagedInstanceImpl withTimezoneId(String timezoneId) { + if (isInCreateMode()) { + this.inner().withTimezoneId(timezoneId); + } else { + this.updateParameter.withTimezoneId(timezoneId); + } + return this; + } + + @Override + public ManagedInstanceImpl withVCores(Integer vCores) { + if (isInCreateMode()) { + this.inner().withVCores(vCores); + } else { + this.updateParameter.withVCores(vCores); + } + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceInner.java new file mode 100644 index 0000000000000..e72bcc7ac5de1 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceInner.java @@ -0,0 +1,608 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ResourceIdentity; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLicenseType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceProxyOverride; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL managed instance. + */ +@JsonFlatten +public class ManagedInstanceInner extends Resource { + /** + * The Azure Active Directory identity of the managed instance. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /** + * Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, + * BC_Gen4, BC_Gen5. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /** + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /** + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ManagedInstanceLicenseType licenseType; + + /** + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Collation of the managed instance. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "properties.dnsZone", access = JsonProperty.Access.WRITE_ONLY) + private String dnsZone; + + /** + * The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + */ + @JsonProperty(value = "properties.dnsZonePartner") + private String dnsZonePartner; + + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + + /** + * Specifies maintenance configuration id to apply to this managed + * instance. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /** + * Get the Azure Active Directory identity of the managed instance. + * + * @return the identity value + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the Azure Active Directory identity of the managed instance. + * + * @param identity the identity value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @param sku the sku value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + + /** + * Get the fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for managed instance creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for managed instance creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get subnet resource ID for the managed instance. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state of the managed instance. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ManagedInstanceLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(ManagedInstanceLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get collation of the managed instance. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set collation of the managed instance. + * + * @param collation the collation value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the Dns Zone that the managed instance is in. + * + * @return the dnsZone value + */ + public String dnsZone() { + return this.dnsZone; + } + + /** + * Get the resource id of another managed instance whose DNS zone this managed instance will share after creation. + * + * @return the dnsZonePartner value + */ + public String dnsZonePartner() { + return this.dnsZonePartner; + } + + /** + * Set the resource id of another managed instance whose DNS zone this managed instance will share after creation. + * + * @param dnsZonePartner the dnsZonePartner value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withDnsZonePartner(String dnsZonePartner) { + this.dnsZonePartner = dnsZonePartner; + return this; + } + + /** + * Get whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @return the proxyOverride value + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + + /** + * Get specifies maintenance configuration id to apply to this managed instance. + * + * @return the maintenanceConfigurationId value + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set specifies maintenance configuration id to apply to this managed instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..1524da51daa5e --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionBackup; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ManagedInstanceLongTermRetentionBackupImpl extends IndexableRefreshableWrapperImpl implements ManagedInstanceLongTermRetentionBackup { + private final SqlManager manager; + private String locationName; + private String managedInstanceName; + private String databaseName; + private String backupName; + + ManagedInstanceLongTermRetentionBackupImpl(ManagedInstanceLongTermRetentionBackupInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionManagedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionDatabases"); + this.backupName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionManagedInstanceBackups"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + LongTermRetentionManagedInstanceBackupsInner client = this.manager().inner().longTermRetentionManagedInstanceBackups(); + return client.getAsync(this.locationName, this.managedInstanceName, this.databaseName, this.backupName); + } + + + + @Override + public DateTime backupExpirationTime() { + return this.inner().backupExpirationTime(); + } + + @Override + public DateTime backupTime() { + return this.inner().backupTime(); + } + + @Override + public DateTime databaseDeletionTime() { + return this.inner().databaseDeletionTime(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime managedInstanceCreateTime() { + return this.inner().managedInstanceCreateTime(); + } + + @Override + public String managedInstanceName() { + return this.inner().managedInstanceName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..840dac49273c8 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionBackupInner.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A long term retention backup for a managed database. + */ +@JsonFlatten +public class ManagedInstanceLongTermRetentionBackupInner extends ProxyResource { + /** + * The managed instance that the backup database belongs to. + */ + @JsonProperty(value = "properties.managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /** + * The create time of the instance. + */ + @JsonProperty(value = "properties.managedInstanceCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime managedInstanceCreateTime; + + /** + * The name of the database the backup belong to. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The delete time of the database. + */ + @JsonProperty(value = "properties.databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime databaseDeletionTime; + + /** + * The time the backup was taken. + */ + @JsonProperty(value = "properties.backupTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime backupTime; + + /** + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "properties.backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime backupExpirationTime; + + /** + * Get the managed instance that the backup database belongs to. + * + * @return the managedInstanceName value + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the create time of the instance. + * + * @return the managedInstanceCreateTime value + */ + public DateTime managedInstanceCreateTime() { + return this.managedInstanceCreateTime; + } + + /** + * Get the name of the database the backup belong to. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the delete time of the database. + * + * @return the databaseDeletionTime value + */ + public DateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the time the backup was taken. + * + * @return the backupTime value + */ + public DateTime backupTime() { + return this.backupTime; + } + + /** + * Get the time the long term retention backup will expire. + * + * @return the backupExpirationTime value + */ + public DateTime backupExpirationTime() { + return this.backupExpirationTime; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..9c01fe6380c94 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicy; + +class ManagedInstanceLongTermRetentionPoliciesImpl extends WrapperImpl implements ManagedInstanceLongTermRetentionPolicies { + private final SqlManager manager; + + ManagedInstanceLongTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().managedInstanceLongTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedInstanceLongTermRetentionPolicyImpl wrapModel(ManagedInstanceLongTermRetentionPolicyInner inner) { + return new ManagedInstanceLongTermRetentionPolicyImpl(inner, manager()); + } + + private ManagedInstanceLongTermRetentionPolicyImpl wrapModel(String name) { + return new ManagedInstanceLongTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedInstanceLongTermRetentionPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceLongTermRetentionPolicy call(ManagedInstanceLongTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedInstanceLongTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(ManagedInstanceLongTermRetentionPolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedInstanceLongTermRetentionPolicy)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..c0567ce3cca5c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPoliciesInner.java @@ -0,0 +1,609 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedInstanceLongTermRetentionPolicies. + */ +public class ManagedInstanceLongTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceLongTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceLongTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceLongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceLongTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceLongTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceLongTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceLongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceLongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceLongTermRetentionPolicyInner object if successful. + */ + public ManagedInstanceLongTermRetentionPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedInstanceLongTermRetentionPolicyInner>() { + @Override + public ManagedInstanceLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceLongTermRetentionPolicyInner object if successful. + */ + public ManagedInstanceLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedInstanceLongTermRetentionPolicyInner>() { + @Override + public ManagedInstanceLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceLongTermRetentionPolicyInner object if successful. + */ + public ManagedInstanceLongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedInstanceLongTermRetentionPolicyInner>() { + @Override + public ManagedInstanceLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceLongTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedInstanceLongTermRetentionPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database's long term retention policy. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a database's long term retention policy. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a database's long term retention policy. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceLongTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..c5ec2e4e04585 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ManagedInstanceLongTermRetentionPolicyImpl extends CreatableUpdatableImpl implements ManagedInstanceLongTermRetentionPolicy, ManagedInstanceLongTermRetentionPolicy.Definition, ManagedInstanceLongTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedInstanceLongTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceLongTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedInstanceLongTermRetentionPolicyImpl(ManagedInstanceLongTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstanceLongTermRetentionPoliciesInner client = this.manager().inner().managedInstanceLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstanceLongTermRetentionPoliciesInner client = this.manager().inner().managedInstanceLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceLongTermRetentionPoliciesInner client = this.manager().inner().managedInstanceLongTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String monthlyRetention() { + return this.inner().monthlyRetention(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String weeklyRetention() { + return this.inner().weeklyRetention(); + } + + @Override + public Integer weekOfYear() { + return this.inner().weekOfYear(); + } + + @Override + public String yearlyRetention() { + return this.inner().yearlyRetention(); + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.inner().withMonthlyRetention(monthlyRetention); + return this; + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.inner().withWeeklyRetention(weeklyRetention); + return this; + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.inner().withWeekOfYear(weekOfYear); + return this; + } + + @Override + public ManagedInstanceLongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.inner().withYearlyRetention(yearlyRetention); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..d4e2f30af4621 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceLongTermRetentionPolicyInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A long term retention policy. + */ +@JsonFlatten +public class ManagedInstanceLongTermRetentionPolicyInner extends ProxyResource { + /** + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weeklyRetention") + private String weeklyRetention; + + /** + * The monthly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.monthlyRetention") + private String monthlyRetention; + + /** + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.yearlyRetention") + private String yearlyRetention; + + /** + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weekOfYear") + private Integer weekOfYear; + + /** + * Get the weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value + */ + public String weeklyRetention() { + return this.weeklyRetention; + } + + /** + * Set the weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value + */ + public String monthlyRetention() { + return this.monthlyRetention; + } + + /** + * Set the monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; + } + + /** + * Get the yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value + */ + public String yearlyRetention() { + return this.yearlyRetention; + } + + /** + * Set the yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; + return this; + } + + /** + * Get the week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value + */ + public Integer weekOfYear() { + return this.weekOfYear; + } + + /** + * Set the week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationImpl.java new file mode 100644 index 0000000000000..c05c5a8034a16 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationImpl.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperation; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperationParametersPair; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperationSteps; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagementOperationState; + +class ManagedInstanceOperationImpl extends IndexableRefreshableWrapperImpl implements ManagedInstanceOperation { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private UUID operationId; + + ManagedInstanceOperationImpl(ManagedInstanceOperationInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.operationId = UUID.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "operations")); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceOperationsInner client = this.manager().inner().managedInstanceOperations(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.operationId); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorDescription() { + return this.inner().errorDescription(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public DateTime estimatedCompletionTime() { + return this.inner().estimatedCompletionTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isCancellable() { + return this.inner().isCancellable(); + } + + @Override + public Boolean isUserError() { + return this.inner().isUserError(); + } + + @Override + public String managedInstanceName() { + return this.inner().managedInstanceName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public ManagedInstanceOperationParametersPair operationParameters() { + return this.inner().operationParameters(); + } + + @Override + public ManagedInstanceOperationSteps operationSteps() { + return this.inner().operationSteps(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public ManagementOperationState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationInner.java new file mode 100644 index 0000000000000..a10a57bdfa22b --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationInner.java @@ -0,0 +1,250 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagementOperationState; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperationParametersPair; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperationSteps; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed instance operation. + */ +@JsonFlatten +public class ManagedInstanceOperationInner extends ProxyResource { + /** + * The name of the managed instance the operation is being performed on. + */ + @JsonProperty(value = "properties.managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /** + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /** + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation state. Possible values include: 'Pending', 'InProgress', + * 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /** + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /** + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /** + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime estimatedCompletionTime; + + /** + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * The operation parameters. + */ + @JsonProperty(value = "properties.operationParameters", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationParametersPair operationParameters; + + /** + * The operation steps. + */ + @JsonProperty(value = "properties.operationSteps", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationSteps operationSteps; + + /** + * Get the name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the name of operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the friendly name of operation. + * + * @return the operationFriendlyName value + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentage of the operation completed. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the operation start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled'. + * + * @return the state value + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the operation error code. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the operation error description. + * + * @return the errorDescription value + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the operation error severity. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get whether or not the error is a user error. + * + * @return the isUserError value + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimated completion time of the operation. + * + * @return the estimatedCompletionTime value + */ + public DateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get whether the operation can be cancelled. + * + * @return the isCancellable value + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Get the operation parameters. + * + * @return the operationParameters value + */ + public ManagedInstanceOperationParametersPair operationParameters() { + return this.operationParameters; + } + + /** + * Get the operation steps. + * + * @return the operationSteps value + */ + public ManagedInstanceOperationSteps operationSteps() { + return this.operationSteps; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsImpl.java new file mode 100644 index 0000000000000..bd734f5ee8ebb --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsImpl.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperation; +import com.microsoft.azure.Page; + +class ManagedInstanceOperationsImpl extends WrapperImpl implements ManagedInstanceOperations { + private final SqlManager manager; + + ManagedInstanceOperationsImpl(SqlManager manager) { + super(manager.inner().managedInstanceOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedInstanceOperationImpl wrapManagedInstanceOperationModel(ManagedInstanceOperationInner inner) { + return new ManagedInstanceOperationImpl(inner, manager()); + } + + private Observable getManagedInstanceOperationInnerUsingManagedInstanceOperationsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String operationId = UUID.fromString(IdParsingUtils.getValueFromIdByName(id, "operations")); + ManagedInstanceOperationsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, operationId); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, UUID operationId) { + ManagedInstanceOperationsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, operationId) + .flatMap(new Func1>() { + @Override + public Observable call(ManagedInstanceOperationInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedInstanceOperation)wrapManagedInstanceOperationModel(inner)); + } + } + }); + } + + @Override + public Observable listByManagedInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceOperationsInner client = this.inner(); + return client.listByManagedInstanceAsync(resourceGroupName, managedInstanceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceOperation call(ManagedInstanceOperationInner inner) { + return wrapManagedInstanceOperationModel(inner); + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsInner.java new file mode 100644 index 0000000000000..e0273f2cd8f29 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceOperationsInner.java @@ -0,0 +1,402 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedInstanceOperations. + */ +public class ManagedInstanceOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperations listByManagedInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations") + Observable> listByManagedInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperations get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("operationId") UUID operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperations listByManagedInstanceNext" }) + @GET + Observable> listByManagedInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceOperationInner> object if successful. + */ + public PagedList listByManagedInstance(final String resourceGroupName, final String managedInstanceName) { + ServiceResponse> response = listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagedInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagedInstanceAsync(final String resourceGroupName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagedInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceOperationInner> object + */ + public Observable> listByManagedInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + return listByManagedInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceOperationInner> object + */ + public Observable>> listByManagedInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName) { + return listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagedInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the managed instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagedInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByManagedInstance(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagedInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagedInstanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId the UUID value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceOperationInner object if successful. + */ + public ManagedInstanceOperationInner get(String resourceGroupName, String managedInstanceName, UUID operationId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, operationId).toBlocking().single().body(); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId the UUID value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, operationId), serviceCallback); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId the UUID value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceOperationInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, UUID operationId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, operationId).map(new Func1, ManagedInstanceOperationInner>() { + @Override + public ManagedInstanceOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId the UUID value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceOperationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, UUID operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, managedInstanceName, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceOperationInner> object if successful. + */ + public PagedList listByManagedInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByManagedInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagedInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagedInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagedInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagedInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceOperationInner> object + */ + public Observable> listByManagedInstanceNextAsync(final String nextPageLink) { + return listByManagedInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceOperationInner> object + */ + public Observable>> listByManagedInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagedInstanceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagedInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the managed instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagedInstanceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagedInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagedInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagedInstanceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java index 7c5833ba25025..80a4d1f7d868e 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java @@ -26,8 +26,8 @@ public class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { private String storageContainerPath; /** - * A shared access signature (SAS Key) that has write access to the blob - * container specified in 'storageContainerPath' parameter. If + * A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is * required. */ @@ -69,7 +69,7 @@ public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerPath(Stri } /** - * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * Get a shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. * * @return the storageContainerSasKey value */ @@ -78,7 +78,7 @@ public String storageContainerSasKey() { } /** - * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * Set a shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. * * @param storageContainerSasKey the storageContainerSasKey value to set * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java index 8f1807d7e20ac..0d49edf96c380 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -53,10 +53,14 @@ private Observable getManagedInstan public Observable getAsync(String resourceGroupName, String managedInstanceName) { ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); return client.getAsync(resourceGroupName, managedInstanceName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ManagedInstanceVulnerabilityAssessment call(ManagedInstanceVulnerabilityAssessmentInner inner) { - return wrapManagedInstanceVulnerabilityAssessmentModel(inner); + public Observable call(ManagedInstanceVulnerabilityAssessmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ManagedInstanceVulnerabilityAssessment)wrapManagedInstanceVulnerabilityAssessmentModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesImpl.java new file mode 100644 index 0000000000000..30d8b2db103f8 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesImpl.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstance; + +class ManagedInstancesImpl extends WrapperImpl implements ManagedInstances { + private final SqlManager manager; + + ManagedInstancesImpl(SqlManager manager) { + super(manager.inner().managedInstances()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceImpl define(String name) { + return wrapModel(name); + } + + private ManagedInstanceImpl wrapModel(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner, manager()); + } + + private ManagedInstanceImpl wrapModel(String name) { + return new ManagedInstanceImpl(name, this.manager()); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstancesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedInstance call(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstancesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName).toCompletable(); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + ManagedInstancesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstance call(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ManagedInstancesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstance call(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + ManagedInstancesInner client = this.inner(); + return client.listByInstancePoolAsync(resourceGroupName, instancePoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstance call(ManagedInstanceInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesInner.java new file mode 100644 index 0000000000000..202817e3ab418 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstancesInner.java @@ -0,0 +1,1387 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedInstances. + */ +public class ManagedInstancesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ManagedInstancesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstancesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstances to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances listByInstancePool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances") + Observable> listByInstancePool(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances listByInstancePoolNext" }) + @GET + Observable> listByInstancePoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listByInstancePool(final String resourceGroupName, final String instancePoolName) { + ServiceResponse> response = listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolWithServiceResponseAsync(resourceGroupName, instancePoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listByInstancePoolWithServiceResponseAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolSinglePageAsync(final String resourceGroupName, final String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInstancePool(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String managedInstanceName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().last().body(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String managedInstanceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listByInstancePoolNext(final String nextPageLink) { + ServiceResponse> response = listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstancePoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listByInstancePoolNextAsync(final String nextPageLink) { + return listByInstancePoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listByInstancePoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInstancePoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..b1227357e4bc8 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointProperty; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateLinkServiceConnectionStateProperty; + +class PrivateEndpointConnectionImpl extends CreatableUpdatableImpl implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String privateEndpointConnectionName; + + PrivateEndpointConnectionImpl(String name, SqlManager manager) { + super(name, new PrivateEndpointConnectionInner()); + this.manager = manager; + // Set resource name + this.privateEndpointConnectionName = name; + // + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.privateEndpointConnectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.privateEndpointConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "privateEndpointConnections"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.privateEndpointConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.privateEndpointConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.getAsync(this.resourceGroupName, this.serverName, this.privateEndpointConnectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public PrivateEndpointProperty privateEndpoint() { + return this.inner().privateEndpoint(); + } + + @Override + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.inner().privateLinkServiceConnectionState(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.inner().withPrivateEndpoint(privateEndpoint); + return this; + } + + @Override + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.inner().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..75910816b8767 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointProperty; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A private endpoint connection. + */ +@JsonFlatten +public class PrivateEndpointConnectionInner extends ProxyResource { + /** + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /** + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /** + * State of the private endpoint connection. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get private endpoint which the connection belongs to. + * + * @return the privateEndpoint value + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get state of the private endpoint connection. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..4fe83b0913e58 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnection; + +class PrivateEndpointConnectionsImpl extends WrapperImpl implements PrivateEndpointConnections { + private final SqlManager manager; + + PrivateEndpointConnectionsImpl(SqlManager manager) { + super(manager.inner().privateEndpointConnections()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public PrivateEndpointConnectionImpl define(String name) { + return wrapModel(name); + } + + private PrivateEndpointConnectionImpl wrapModel(PrivateEndpointConnectionInner inner) { + return new PrivateEndpointConnectionImpl(inner, manager()); + } + + private PrivateEndpointConnectionImpl wrapModel(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PrivateEndpointConnection call(PrivateEndpointConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap(new Func1>() { + @Override + public Observable call(PrivateEndpointConnectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PrivateEndpointConnection)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsInner.java new file mode 100644 index 0000000000000..e75da31e8dab5 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PrivateEndpointConnectionsInner.java @@ -0,0 +1,776 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PrivateEndpointConnections. + */ +public class PrivateEndpointConnectionsInner { + /** The Retrofit service to perform REST calls. */ + private PrivateEndpointConnectionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PrivateEndpointConnectionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(PrivateEndpointConnectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PrivateEndpointConnections to be + * used by Retrofit to perform actually REST calls. + */ + interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Path("subscriptionId") String subscriptionId, @Body PrivateEndpointConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Path("subscriptionId") String subscriptionId, @Body PrivateEndpointConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner get(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).toBlocking().single().body(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, serverName, privateEndpointConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).toBlocking().last().body(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters), serviceCallback); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, privateEndpointConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters), serviceCallback); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, serverName, privateEndpointConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).toBlocking().last().body(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, serverName, privateEndpointConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).toBlocking().single().body(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, serverName, privateEndpointConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PrivateEndpointConnectionInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String resourceGroupName, final String serverName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PrivateEndpointConnectionInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PrivateEndpointConnectionInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { + return listByServerSinglePageAsync(resourceGroupName, serverName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all private endpoint connections on a server. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PrivateEndpointConnectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PrivateEndpointConnectionInner> object if successful. + */ + public PagedList listByServerNext(final String nextPageLink) { + ServiceResponse> response = listByServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all private endpoint connections on a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PrivateEndpointConnectionInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PrivateEndpointConnectionInner> object + */ + public Observable>> listByServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all private endpoint connections on a server. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PrivateEndpointConnectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/RecommendedSensitivityLabelsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..8b9a68c5c96de --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/RecommendedSensitivityLabelsImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.RecommendedSensitivityLabels; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabelRank; + +class RecommendedSensitivityLabelsImpl extends WrapperImpl implements RecommendedSensitivityLabels { + private final SqlManager manager; + + RecommendedSensitivityLabelsImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SensitivityLabelRank rank() { + return this.inner().rank(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelInner.java new file mode 100644 index 0000000000000..c6a0d81648292 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelInner.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A sensitivity label. + */ +@JsonFlatten +public class SensitivityLabelInner extends ProxyResource { + /** + * The label name. + */ + @JsonProperty(value = "properties.labelName") + private String labelName; + + /** + * The label ID. + */ + @JsonProperty(value = "properties.labelId") + private String labelId; + + /** + * The information type. + */ + @JsonProperty(value = "properties.informationType") + private String informationType; + + /** + * The information type ID. + */ + @JsonProperty(value = "properties.informationTypeId") + private String informationTypeId; + + /** + * Is sensitivity recommendation disabled. Applicable for recommended + * sensitivity label only. Specifies whether the sensitivity recommendation + * on this column is disabled (dismissed) or not. + */ + @JsonProperty(value = "properties.isDisabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDisabled; + + /** + * Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical'. + */ + @JsonProperty(value = "properties.rank") + private SensitivityLabelRank rank; + + /** + * Get the label name. + * + * @return the labelName value + */ + public String labelName() { + return this.labelName; + } + + /** + * Set the label name. + * + * @param labelName the labelName value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the label ID. + * + * @return the labelId value + */ + public String labelId() { + return this.labelId; + } + + /** + * Set the label ID. + * + * @param labelId the labelId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the information type. + * + * @return the informationType value + */ + public String informationType() { + return this.informationType; + } + + /** + * Set the information type. + * + * @param informationType the informationType value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationType(String informationType) { + this.informationType = informationType; + return this; + } + + /** + * Get the information type ID. + * + * @return the informationTypeId value + */ + public String informationTypeId() { + return this.informationTypeId; + } + + /** + * Set the information type ID. + * + * @param informationTypeId the informationTypeId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationTypeId(String informationTypeId) { + this.informationTypeId = informationTypeId; + return this; + } + + /** + * Get is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value + */ + public Boolean isDisabled() { + return this.isDisabled; + } + + /** + * Get possible values include: 'None', 'Low', 'Medium', 'High', 'Critical'. + * + * @return the rank value + */ + public SensitivityLabelRank rank() { + return this.rank; + } + + /** + * Set possible values include: 'None', 'Low', 'Medium', 'High', 'Critical'. + * + * @param rank the rank value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withRank(SensitivityLabelRank rank) { + this.rank = rank; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelsImpl.java new file mode 100644 index 0000000000000..9f92082bf8823 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabels; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.SensitivityLabelRank; + +class SensitivityLabelsImpl extends CreatableUpdatableImpl implements SensitivityLabels, SensitivityLabels.Definition, SensitivityLabels.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String schemaName; + private String tableName; + private String columnName; + + SensitivityLabelsImpl(String name, SqlManager manager) { + super(name, new SensitivityLabelInner()); + this.manager = manager; + // Set resource name + this.columnName = name; + // + } + + SensitivityLabelsImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.columnName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.schemaName = IdParsingUtils.getValueFromIdByName(inner.id(), "schemas"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + this.columnName = IdParsingUtils.getValueFromIdByName(inner.id(), "columns"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabaseSensitivityLabelsInner client = this.manager().inner().managedDatabaseSensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseSensitivityLabelsInner client = this.manager().inner().managedDatabaseSensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseSensitivityLabelsInner client = this.manager().inner().managedDatabaseSensitivityLabels(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.schemaName, this.tableName, this.columnName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SensitivityLabelRank rank() { + return this.inner().rank(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SensitivityLabelsImpl withExistingColumn(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName, String columnName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + @Override + public SensitivityLabelsImpl withInformationType(String informationType) { + this.inner().withInformationType(informationType); + return this; + } + + @Override + public SensitivityLabelsImpl withInformationTypeId(String informationTypeId) { + this.inner().withInformationTypeId(informationTypeId); + return this; + } + + @Override + public SensitivityLabelsImpl withLabelId(String labelId) { + this.inner().withLabelId(labelId); + return this; + } + + @Override + public SensitivityLabelsImpl withLabelName(String labelName) { + this.inner().withLabelName(labelName); + return this; + } + + @Override + public SensitivityLabelsImpl withRank(SensitivityLabelRank rank) { + this.inner().withRank(rank); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorImpl.java new file mode 100644 index 0000000000000..949b85e4b40cb --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorImpl.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrator; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; + +class ServerAzureADAdministratorImpl extends CreatableUpdatableImpl implements ServerAzureADAdministrator, ServerAzureADAdministrator.Definition, ServerAzureADAdministrator.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerAzureADAdministratorImpl(String name, SqlManager manager) { + super(name, new ServerAzureADAdministratorInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerAzureADAdministratorImpl(ServerAzureADAdministratorInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerAzureADAdministratorsInner client = this.manager().inner().serverAzureADAdministrators(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerAzureADAdministratorsInner client = this.manager().inner().serverAzureADAdministrators(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerAzureADAdministratorsInner client = this.manager().inner().serverAzureADAdministrators(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String administratorType() { + return this.inner().administratorType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String login() { + return this.inner().login(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public UUID sid() { + return this.inner().sid(); + } + + @Override + public UUID tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerAzureADAdministratorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerAzureADAdministratorImpl withAdministratorType(String administratorType) { + this.inner().withAdministratorType(administratorType); + return this; + } + + @Override + public ServerAzureADAdministratorImpl withLogin(String login) { + this.inner().withLogin(login); + return this; + } + + @Override + public ServerAzureADAdministratorImpl withSid(UUID sid) { + this.inner().withSid(sid); + return this; + } + + @Override + public ServerAzureADAdministratorImpl withTenantId(UUID tenantId) { + this.inner().withTenantId(tenantId); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorInner.java new file mode 100644 index 0000000000000..d96fddaa9aa33 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorInner.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Azure Active Directory administrator. + */ +@JsonFlatten +public class ServerAzureADAdministratorInner extends ProxyResource { + /** + * Type of the sever administrator. + */ + @JsonProperty(value = "properties.administratorType", required = true) + private String administratorType; + + /** + * Login name of the server administrator. + */ + @JsonProperty(value = "properties.login", required = true) + private String login; + + /** + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "properties.sid", required = true) + private UUID sid; + + /** + * Tenant ID of the administrator. + */ + @JsonProperty(value = "properties.tenantId") + private UUID tenantId; + + /** + * Creates an instance of ServerAzureADAdministratorInner class. + * @param login login name of the server administrator. + * @param sid sID (object ID) of the server administrator. + */ + public ServerAzureADAdministratorInner() { + administratorType = "ActiveDirectory"; + } + + /** + * Get type of the sever administrator. + * + * @return the administratorType value + */ + public String administratorType() { + return this.administratorType; + } + + /** + * Set type of the sever administrator. + * + * @param administratorType the administratorType value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withAdministratorType(String administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get login name of the server administrator. + * + * @return the login value + */ + public String login() { + return this.login; + } + + /** + * Set login name of the server administrator. + * + * @param login the login value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get sID (object ID) of the server administrator. + * + * @return the sid value + */ + public UUID sid() { + return this.sid; + } + + /** + * Set sID (object ID) of the server administrator. + * + * @param sid the sid value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get tenant ID of the administrator. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set tenant ID of the administrator. + * + * @param tenantId the tenantId value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsImpl.java new file mode 100644 index 0000000000000..9742d1a2c472c --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrator; +import com.microsoft.azure.Page; +import rx.Completable; + +class ServerAzureADAdministratorsImpl extends WrapperImpl implements ServerAzureADAdministrators { + private final SqlManager manager; + + ServerAzureADAdministratorsImpl(SqlManager manager) { + super(manager.inner().serverAzureADAdministrators()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerAzureADAdministratorImpl defineAdministrator(String name) { + return wrapAdministratorModel(name); + } + + private ServerAzureADAdministratorImpl wrapAdministratorModel(String name) { + return new ServerAzureADAdministratorImpl(name, this.manager()); + } + + private ServerAzureADAdministratorImpl wrapServerAzureADAdministratorModel(ServerAzureADAdministratorInner inner) { + return new ServerAzureADAdministratorImpl(inner, manager()); + } + + private Observable getServerAzureADAdministratorInnerUsingServerAzureADAdministratorsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + ServerAzureADAdministratorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .flatMap(new Func1>() { + @Override + public Observable call(ServerAzureADAdministratorInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ServerAzureADAdministrator)wrapServerAzureADAdministratorModel(inner)); + } + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ServerAzureADAdministrator call(ServerAzureADAdministratorInner inner) { + return wrapServerAzureADAdministratorModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName).toCompletable(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsInner.java new file mode 100644 index 0000000000000..3150c80ece838 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerAzureADAdministratorsInner.java @@ -0,0 +1,748 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerAzureADAdministrators. + */ +public class ServerAzureADAdministratorsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ServerAzureADAdministratorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAzureADAdministratorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerAzureADAdministratorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerAzureADAdministratorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerAzureADAdministrators to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerAzureADAdministratorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("administratorName") String administratorName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("administratorName") String administratorName, @Query("api-version") String apiVersion, @Body ServerAzureADAdministratorInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("administratorName") String administratorName, @Query("api-version") String apiVersion, @Body ServerAzureADAdministratorInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("administratorName") String administratorName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("administratorName") String administratorName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a server Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a server Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAzureADAdministratorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAzureADAdministratorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String administratorName = "ActiveDirectory"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner createOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String administratorName = "ActiveDirectory"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAzureADAdministratorInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating an Active Directory Administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAzureADAdministratorInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerAzureADAdministratorInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String administratorName = "ActiveDirectory"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().last().body(); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String administratorName = "ActiveDirectory"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String serverName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String administratorName = "ActiveDirectory"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of server Administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ServerAzureADAdministratorInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of server Administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String resourceGroupName, final String serverName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of server Administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerAzureADAdministratorInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server Administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerAzureADAdministratorInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { + return listByServerSinglePageAsync(resourceGroupName, serverName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of server Administrators. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerAzureADAdministratorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of server Administrators. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ServerAzureADAdministratorInner> object if successful. + */ + public PagedList listByServerNext(final String nextPageLink) { + ServiceResponse> response = listByServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of server Administrators. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of server Administrators. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerAzureADAdministratorInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server Administrators. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerAzureADAdministratorInner> object + */ + public Observable>> listByServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of server Administrators. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerAzureADAdministratorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java index d171928b3733c..7976256fa2069 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java @@ -26,8 +26,8 @@ public class ServerVulnerabilityAssessmentInner extends ProxyResource { private String storageContainerPath; /** - * A shared access signature (SAS Key) that has write access to the blob - * container specified in 'storageContainerPath' parameter. If + * A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is * required. */ @@ -69,7 +69,7 @@ public ServerVulnerabilityAssessmentInner withStorageContainerPath(String storag } /** - * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * Get a shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. * * @return the storageContainerSasKey value */ @@ -78,7 +78,7 @@ public String storageContainerSasKey() { } /** - * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * Set a shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. * * @param storageContainerSasKey the storageContainerSasKey value to set * @return the ServerVulnerabilityAssessmentInner object itself. diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java index 1a8d677eaaf3c..bf42770486576 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -53,10 +53,14 @@ private Observable getServerVulnerabilityAss public Observable getAsync(String resourceGroupName, String serverName) { ServerVulnerabilityAssessmentsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ServerVulnerabilityAssessment call(ServerVulnerabilityAssessmentInner inner) { - return wrapServerVulnerabilityAssessmentModel(inner); + public Observable call(ServerVulnerabilityAssessmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ServerVulnerabilityAssessment)wrapServerVulnerabilityAssessmentModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java index 35b0b123556a6..80d6269556385 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java @@ -132,6 +132,32 @@ public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClien return this; } + /** + * The DatabaseSecurityAlertPoliciesInner object to access its operations. + */ + private DatabaseSecurityAlertPoliciesInner databaseSecurityAlertPolicies; + + /** + * Gets the DatabaseSecurityAlertPoliciesInner object to access its operations. + * @return the DatabaseSecurityAlertPoliciesInner object. + */ + public DatabaseSecurityAlertPoliciesInner databaseSecurityAlertPolicies() { + return this.databaseSecurityAlertPolicies; + } + + /** + * The ManagedDatabaseSensitivityLabelsInner object to access its operations. + */ + private ManagedDatabaseSensitivityLabelsInner managedDatabaseSensitivityLabels; + + /** + * Gets the ManagedDatabaseSensitivityLabelsInner object to access its operations. + * @return the ManagedDatabaseSensitivityLabelsInner object. + */ + public ManagedDatabaseSensitivityLabelsInner managedDatabaseSensitivityLabels() { + return this.managedDatabaseSensitivityLabels; + } + /** * The ManagedInstanceVulnerabilityAssessmentsInner object to access its operations. */ @@ -145,6 +171,19 @@ public ManagedInstanceVulnerabilityAssessmentsInner managedInstanceVulnerability return this.managedInstanceVulnerabilityAssessments; } + /** + * The ManagedInstanceOperationsInner object to access its operations. + */ + private ManagedInstanceOperationsInner managedInstanceOperations; + + /** + * Gets the ManagedInstanceOperationsInner object to access its operations. + * @return the ManagedInstanceOperationsInner object. + */ + public ManagedInstanceOperationsInner managedInstanceOperations() { + return this.managedInstanceOperations; + } + /** * The ServerVulnerabilityAssessmentsInner object to access its operations. */ @@ -158,6 +197,149 @@ public ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments() { return this.serverVulnerabilityAssessments; } + /** + * The InstancePoolsInner object to access its operations. + */ + private InstancePoolsInner instancePools; + + /** + * Gets the InstancePoolsInner object to access its operations. + * @return the InstancePoolsInner object. + */ + public InstancePoolsInner instancePools() { + return this.instancePools; + } + + /** + * The UsagesInner object to access its operations. + */ + private UsagesInner usages; + + /** + * Gets the UsagesInner object to access its operations. + * @return the UsagesInner object. + */ + public UsagesInner usages() { + return this.usages; + } + + /** + * The ManagedInstancesInner object to access its operations. + */ + private ManagedInstancesInner managedInstances; + + /** + * Gets the ManagedInstancesInner object to access its operations. + * @return the ManagedInstancesInner object. + */ + public ManagedInstancesInner managedInstances() { + return this.managedInstances; + } + + /** + * The ManagedDatabaseRestoreDetailsInner object to access its operations. + */ + private ManagedDatabaseRestoreDetailsInner managedDatabaseRestoreDetails; + + /** + * Gets the ManagedDatabaseRestoreDetailsInner object to access its operations. + * @return the ManagedDatabaseRestoreDetailsInner object. + */ + public ManagedDatabaseRestoreDetailsInner managedDatabaseRestoreDetails() { + return this.managedDatabaseRestoreDetails; + } + + /** + * The ManagedDatabasesInner object to access its operations. + */ + private ManagedDatabasesInner managedDatabases; + + /** + * Gets the ManagedDatabasesInner object to access its operations. + * @return the ManagedDatabasesInner object. + */ + public ManagedDatabasesInner managedDatabases() { + return this.managedDatabases; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The ElasticPoolsInner object to access its operations. + */ + private ElasticPoolsInner elasticPools; + + /** + * Gets the ElasticPoolsInner object to access its operations. + * @return the ElasticPoolsInner object. + */ + public ElasticPoolsInner elasticPools() { + return this.elasticPools; + } + + /** + * The PrivateEndpointConnectionsInner object to access its operations. + */ + private PrivateEndpointConnectionsInner privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsInner object to access its operations. + * @return the PrivateEndpointConnectionsInner object. + */ + public PrivateEndpointConnectionsInner privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * The ServerAzureADAdministratorsInner object to access its operations. + */ + private ServerAzureADAdministratorsInner serverAzureADAdministrators; + + /** + * Gets the ServerAzureADAdministratorsInner object to access its operations. + * @return the ServerAzureADAdministratorsInner object. + */ + public ServerAzureADAdministratorsInner serverAzureADAdministrators() { + return this.serverAzureADAdministrators; + } + + /** + * The ManagedInstanceLongTermRetentionPoliciesInner object to access its operations. + */ + private ManagedInstanceLongTermRetentionPoliciesInner managedInstanceLongTermRetentionPolicies; + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesInner object to access its operations. + * @return the ManagedInstanceLongTermRetentionPoliciesInner object. + */ + public ManagedInstanceLongTermRetentionPoliciesInner managedInstanceLongTermRetentionPolicies() { + return this.managedInstanceLongTermRetentionPolicies; + } + + /** + * The LongTermRetentionManagedInstanceBackupsInner object to access its operations. + */ + private LongTermRetentionManagedInstanceBackupsInner longTermRetentionManagedInstanceBackups; + + /** + * Gets the LongTermRetentionManagedInstanceBackupsInner object to access its operations. + * @return the LongTermRetentionManagedInstanceBackupsInner object. + */ + public LongTermRetentionManagedInstanceBackupsInner longTermRetentionManagedInstanceBackups() { + return this.longTermRetentionManagedInstanceBackups; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -193,8 +375,22 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; + this.databaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsInner(restClient().retrofit(), this); this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.managedInstanceOperations = new ManagedInstanceOperationsInner(restClient().retrofit(), this); this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.instancePools = new InstancePoolsInner(restClient().retrofit(), this); + this.usages = new UsagesInner(restClient().retrofit(), this); + this.managedInstances = new ManagedInstancesInner(restClient().retrofit(), this); + this.managedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsInner(restClient().retrofit(), this); + this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.privateEndpointConnections = new PrivateEndpointConnectionsInner(restClient().retrofit(), this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsInner(restClient().retrofit(), this); + this.managedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.longTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java index 2a9cdb27818f1..ba91ebc2d825a 100644 --- a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java @@ -16,8 +16,22 @@ import com.microsoft.azure.arm.resources.AzureConfigurable; import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2018_06_01_preview.DatabaseSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels; import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceOperations; import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usages; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstances; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseRestoreDetails; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabases; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Databases; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ElasticPools; +import com.microsoft.azure.management.sql.v2018_06_01_preview.PrivateEndpointConnections; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerAzureADAdministrators; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceLongTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2018_06_01_preview.LongTermRetentionManagedInstanceBackups; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -25,8 +39,22 @@ * Entry point to Azure Sql resource management. */ public final class SqlManager extends ManagerCore { + private DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies; + private ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels; private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + private ManagedInstanceOperations managedInstanceOperations; private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + private InstancePools instancePools; + private Usages usages; + private ManagedInstances managedInstances; + private ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails; + private ManagedDatabases managedDatabases; + private Databases databases; + private ElasticPools elasticPools; + private PrivateEndpointConnections privateEndpointConnections; + private ServerAzureADAdministrators serverAzureADAdministrators; + private ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies; + private LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups; /** * Get a Configurable instance that can be used to create SqlManager with optional configuration. * @@ -74,6 +102,26 @@ public interface Configurable extends AzureConfigurable { SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); } + /** + * @return Entry point to manage DatabaseSecurityAlertPolicies. + */ + public DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies() { + if (this.databaseSecurityAlertPolicies == null) { + this.databaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesImpl(this); + } + return this.databaseSecurityAlertPolicies; + } + + /** + * @return Entry point to manage ManagedDatabaseSensitivityLabels. + */ + public ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels() { + if (this.managedDatabaseSensitivityLabels == null) { + this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsImpl(this); + } + return this.managedDatabaseSensitivityLabels; + } + /** * @return Entry point to manage ManagedInstanceVulnerabilityAssessments. */ @@ -84,6 +132,16 @@ public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAsses return this.managedInstanceVulnerabilityAssessments; } + /** + * @return Entry point to manage ManagedInstanceOperations. + */ + public ManagedInstanceOperations managedInstanceOperations() { + if (this.managedInstanceOperations == null) { + this.managedInstanceOperations = new ManagedInstanceOperationsImpl(this); + } + return this.managedInstanceOperations; + } + /** * @return Entry point to manage ServerVulnerabilityAssessments. */ @@ -94,6 +152,116 @@ public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { return this.serverVulnerabilityAssessments; } + /** + * @return Entry point to manage InstancePools. + */ + public InstancePools instancePools() { + if (this.instancePools == null) { + this.instancePools = new InstancePoolsImpl(this); + } + return this.instancePools; + } + + /** + * @return Entry point to manage Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(this); + } + return this.usages; + } + + /** + * @return Entry point to manage ManagedInstances. + */ + public ManagedInstances managedInstances() { + if (this.managedInstances == null) { + this.managedInstances = new ManagedInstancesImpl(this); + } + return this.managedInstances; + } + + /** + * @return Entry point to manage ManagedDatabaseRestoreDetails. + */ + public ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails() { + if (this.managedDatabaseRestoreDetails == null) { + this.managedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsImpl(this); + } + return this.managedDatabaseRestoreDetails; + } + + /** + * @return Entry point to manage ManagedDatabases. + */ + public ManagedDatabases managedDatabases() { + if (this.managedDatabases == null) { + this.managedDatabases = new ManagedDatabasesImpl(this); + } + return this.managedDatabases; + } + + /** + * @return Entry point to manage Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(this); + } + return this.databases; + } + + /** + * @return Entry point to manage ElasticPools. + */ + public ElasticPools elasticPools() { + if (this.elasticPools == null) { + this.elasticPools = new ElasticPoolsImpl(this); + } + return this.elasticPools; + } + + /** + * @return Entry point to manage PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + } + return this.privateEndpointConnections; + } + + /** + * @return Entry point to manage ServerAzureADAdministrators. + */ + public ServerAzureADAdministrators serverAzureADAdministrators() { + if (this.serverAzureADAdministrators == null) { + this.serverAzureADAdministrators = new ServerAzureADAdministratorsImpl(this); + } + return this.serverAzureADAdministrators; + } + + /** + * @return Entry point to manage ManagedInstanceLongTermRetentionPolicies. + */ + public ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies() { + if (this.managedInstanceLongTermRetentionPolicies == null) { + this.managedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesImpl(this); + } + return this.managedInstanceLongTermRetentionPolicies; + } + + /** + * @return Entry point to manage LongTermRetentionManagedInstanceBackups. + */ + public LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups() { + if (this.longTermRetentionManagedInstanceBackups == null) { + this.longTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsImpl(this); + } + return this.longTermRetentionManagedInstanceBackups; + } + /** * The implementation for Configurable interface. */ diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageImpl.java new file mode 100644 index 0000000000000..49e23b9b1414a --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageImpl.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Name; + +class UsageImpl extends WrapperImpl implements Usage { + private final SqlManager manager; + + UsageImpl(UsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public Name name() { + return this.inner().name(); + } + + @Override + public Integer requestedLimit() { + return this.inner().requestedLimit(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java new file mode 100644 index 0000000000000..eb02c2b2bebd6 --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.Name; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ARM usage. + */ +public class UsageInner { + /** + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private Name name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Usage unit. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Usage current value. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /** + * Usage limit. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * Usage requested limit. + */ + @JsonProperty(value = "requestedLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedLimit; + + /** + * Get resource ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get resource name. + * + * @return the name value + */ + public Name name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get usage unit. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get usage current value. + * + * @return the currentValue value + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get usage limit. + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get usage requested limit. + * + * @return the requestedLimit value + */ + public Integer requestedLimit() { + return this.requestedLimit; + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..d360255d176ca --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usage; + +class UsagesImpl extends WrapperImpl implements Usages { + private final SqlManager manager; + + UsagesImpl(SqlManager manager) { + super(manager.inner().usages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private UsageImpl wrapModel(UsageInner inner) { + return new UsageImpl(inner, manager()); + } + + @Override + public Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + UsagesInner client = this.inner(); + return client.listByInstancePoolAsync(resourceGroupName, instancePoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Usage call(UsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java new file mode 100644 index 0000000000000..461e7d42154ba --- /dev/null +++ b/sdk/sql/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java @@ -0,0 +1,425 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Usages. + */ +public class UsagesInner { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of UsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usages to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.Usages listByInstancePool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages") + Observable> listByInstancePool(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("expandChildren") Boolean expandChildren, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.Usages listByInstancePoolNext" }) + @GET + Observable> listByInstancePoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<UsageInner> object if successful. + */ + public PagedList listByInstancePool(final String resourceGroupName, final String instancePoolName) { + ServiceResponse> response = listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolWithServiceResponseAsync(resourceGroupName, instancePoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable>> listByInstancePoolWithServiceResponseAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolSinglePageAsync(final String resourceGroupName, final String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean expandChildren = null; + return service.listByInstancePool(resourceGroupName, instancePoolName, this.client.subscriptionId(), expandChildren, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<UsageInner> object if successful. + */ + public PagedList listByInstancePool(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + ServiceResponse> response = listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + return listByInstancePoolWithServiceResponseAsync(resourceGroupName, instancePoolName, expandChildren) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable>> listByInstancePoolWithServiceResponseAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + return listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param instancePoolName The name of the instance pool to be retrieved. + ServiceResponse> * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolSinglePageAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInstancePool(resourceGroupName, instancePoolName, this.client.subscriptionId(), expandChildren, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all instance pool usage metrics. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<UsageInner> object if successful. + */ + public PagedList listByInstancePoolNext(final String nextPageLink) { + ServiceResponse> response = listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstancePoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable> listByInstancePoolNextAsync(final String nextPageLink) { + return listByInstancePoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable>> listByInstancePoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInstancePoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +}